Feature
Currently, mypy statically evaluates some if branches involving only sys.version_info and sys.platform as always false based on the version and platform it is running on. I propose to have it recognize comparisons against sys.hexversion as well.
Pitch
Some specialized functions targeting bugs patched in a certain alpha, beta or release candidate or internal behavioural differences between patch versions would need this functionality. Also, it may be desirable to give alpha/beta/rc versions a grace period for certain small deprecations, only raising an error on their use in the final python release. Implementation-wise, because the exact value of hexversion can be easily retrieved, and sys.platform and sys.version_info have set precedents, I do not believe it would be unreasonably hard to implement.
Feature
Currently, mypy statically evaluates some if branches involving only
sys.version_infoandsys.platformas always false based on the version and platform it is running on. I propose to have it recognize comparisons againstsys.hexversionas well.Pitch
Some specialized functions targeting bugs patched in a certain alpha, beta or release candidate or internal behavioural differences between patch versions would need this functionality. Also, it may be desirable to give alpha/beta/rc versions a grace period for certain small deprecations, only raising an error on their use in the final python release. Implementation-wise, because the exact value of hexversion can be easily retrieved, and
sys.platformandsys.version_infohave set precedents, I do not believe it would be unreasonably hard to implement.