r/Python • Freelancer. AnyFactor.xyz • Sep 16 '20

News An update on Python 4

Post image
3.3k Upvotes

389 comments sorted by

View all comments

Show parent comments

2

u/flying-sheep Sep 16 '20

None of these lists contain versions. Try this one:

from packaging.version import Version

versions = [Version(v) for v in ["3.8", "3.9", "3.10"]]
assert sorted(versions) == versions

For versions containing only numbers (and not e.g. 3.9b1) you can also think of them as tuples of integers.

0

u/Leav Sep 17 '20

Yes, I understand this is how versions work, but to someone who is not familiar with them, it looks extremely weird and confusing.

1

u/flying-sheep Sep 17 '20

Well, welcome to human language notation. There's things that look similar but aren't the same. Boohoo.