MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/Python/comments/itzn13/an_update_on_python_4/g5jszox/?context=3
r/Python • u/anyfactor Freelancer. AnyFactor.xyz • Sep 16 '20
389 comments sorted by
View all comments
Show parent comments
8
Why?
-3 u/Leav Sep 16 '20 Because 3.10 = "3.1 with more precision" to engineers and scientists and basically all non-developer users.How would python sort these lists: [3.8,3.9,3.10] or ["3.8","3.9","3.10"]? 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) == versionsFor 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. → More replies (1)
-3
Because 3.10 = "3.1 with more precision" to engineers and scientists and basically all non-developer users.
How would python sort these lists: [3.8,3.9,3.10] or ["3.8","3.9","3.10"]?
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) == versionsFor 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. → More replies (1)
2
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.
3.9b1
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. → More replies (1)
0
Yes, I understand this is how versions work, but to someone who is not familiar with them, it looks extremely weird and confusing.
→ More replies (1)
8
u/Jethro_Tell Sep 16 '20
Why?