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

-11

u/NTWK_Identifier Sep 16 '20

3.9 -> 3.10

This makes me irrationally angry.

8

u/Jethro_Tell Sep 16 '20

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"]?

14

u/Karnyl Sep 16 '20

If you used a library aware of how versions should be sorted, like semver or distutils.version, then they would be sorted correctly.

>>> from distutils.version import LooseVersion
>>> versions = ["3.8","3.9","3.10"]
>>> sorted(versions, key=LooseVersion)
"3.8","3.9","3.10"

→ More replies (2)