Message364535
I stumbled upon a possible bug in the Python interpreter while doing some Python version comparisons.
Look at this:
"3.10.2" < "3.8.2"
True # This is not true as a version number comparison
Now look at this:
"3.10.2" < "3.08.2"
False # Adding a leading 0 compares those two version numbers correctly
Is it possible Python is fixed to correctly compare such numbers? That would make comparing Python version numbers possible in the future.
import platform
if platform.python_version() < "3.8.2":
# Do something
This is currently possible and correct, but this will break when Python version number becomes 3.10 and you wanna compare this version number to, say, 3.9. |
|
Date |
User |
Action |
Args |
2020-03-18 17:25:19 | PedanticHacker | set | recipients:
+ PedanticHacker, gvanrossum |
2020-03-18 17:25:19 | PedanticHacker | set | messageid: <1584552319.24.0.0522121424801.issue40004@roundup.psfhosted.org> |
2020-03-18 17:25:19 | PedanticHacker | link | issue40004 messages |
2020-03-18 17:25:19 | PedanticHacker | create | |
|