Use sys.version_info in compatibility layer (#220)

* Use sys.version_info in compatibility layer

Fixes #219

Static type checkers are able to understand checks against sys.version_info much better than try-except. In general, if type checkers tried to handle conditional imports fancily, this would result in unsoundness.

Another reason is that you may have tomli conditionally installed based on Python version, in which case a type checker would not even have a way of knowing what tomli is.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Taneli Hukkinen <3275109+hukkin@users.noreply.github.com>
diff --git a/README.md b/README.md
index 6f4b78d..0eddd9e 100644
--- a/README.md
+++ b/README.md
@@ -131,9 +131,11 @@
 Then, in your code, import a TOML parser using the following fallback mechanism:
 
 ```python
-try:
+import sys
+
+if sys.version_info >= (3, 11):
     import tomllib
-except ModuleNotFoundError:
+else:
     import tomli as tomllib
 
 tomllib.loads("['This parses fine with Python 3.6+']")