Closed adferrand closed 1 year ago
Hello !
Concerning conditional imports based on the actual Python version at runtime, Mypy recommendation is to explicitly use sys.version_info to trigger the relevant import depending on the Python version.
sys.version_info
Reference to the documentation: https://mypy.readthedocs.io/en/stable/common_issues.html#python-version-and-system-platform-checks
I apply this approach to the compat module.
compat
As a consequence, Mypy does an educated guess on the imports, and #type: ignore inline comment is not needed anymore.
#type: ignore
Thanks! Did not know that, will use from now on.
Hello !
Concerning conditional imports based on the actual Python version at runtime, Mypy recommendation is to explicitly use
sys.version_info
to trigger the relevant import depending on the Python version.Reference to the documentation: https://mypy.readthedocs.io/en/stable/common_issues.html#python-version-and-system-platform-checks
I apply this approach to the
compat
module.As a consequence, Mypy does an educated guess on the imports, and
#type: ignore
inline comment is not needed anymore.