This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author PedanticHacker
Recipients PedanticHacker, gvanrossum
Date 2020-03-18.17:25:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1584552319.24.0.0522121424801.issue40004@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-03-18 17:25:19PedanticHackersetrecipients: + PedanticHacker, gvanrossum
2020-03-18 17:25:19PedanticHackersetmessageid: <1584552319.24.0.0522121424801.issue40004@roundup.psfhosted.org>
2020-03-18 17:25:19PedanticHackerlinkissue40004 messages
2020-03-18 17:25:19PedanticHackercreate