asottile-archive/flake8-2020

Add check for platform.python_version_tuple

domdfcoding opened this issue · 3 comments

I have observed code using platform.python_version_tuple to check version numbers, but since it is a tuple of strings it gets tripped up by Python 3.10:

>>> platform.python_version_tuple()
('3', '10', '0a3')
>>> platform.python_version_tuple() > ("3", "3")
False
>>> "10" > "3"
False
>>> platform.python_version_tuple()
('3', '8', '5')
>>> platform.python_version_tuple() > ("3", "3")
True
>>> 
>>> "8" > "3"
True

Would you be interested in having a check for this?

yeah looks like this should never be used in comparisons -- would you like to make a PR?

platform.python_version should also be handled (from #31)

closing => archiving