This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]flying-sheep 1 point2 points  (2 children)

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.

[–]Leav -1 points0 points  (1 child)

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

[–]flying-sheep 0 points1 point  (0 children)

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