4 ms·
> about a feature we had since Python 3.6, in 2016 No, you had that feature in one implementation. Now it's in the language specification. That's vastly differ
by rplnt 7y ago
> about a feature we had since Python 3.6, in 2016
No, you had that feature in one implementation. Now it's in the language specification. That's vastly different because only now you can rely on it without fearing it can go away with the next release.
- BiteCode_dev 7y agoFirst, cPython is 99% of Python deployments. So much that if a script works on it but not on another implementation, people often consider the later broken. As this post proves that most people don't even know about this feature, you can be pretty sure the vast majority of people don't know about pypy, micropython, etc. Secondly, even if you want to nit pick, Python 3.7 made it official more than one year ago. We are currently in the 3.9 alpha. In fact, 3.7 didn't touch the implementation, just merely declared "yep, good idea, let's keep it that way".
- deleted 7y ago[deleted]
- squeaky-clean 7y agoThere's also the indication that this is official, and not just an implementation quirk. I still used OrderedDict in 3.6 because there was no guarantee 3.7 (or later) wouldn't silently break ordering on the standard dict. At least now it's unlikely to change because it will be considered a breaking change.
- d0mine 7y agoBDFL declared Python dict to be ordered in 2017 — It can't be more official than that for Python https://mail.python.org/pipermail/python-dev/2017-December/151283.html https://mail.python.org/pipermail/python-dev/2017-December/1... i.e., Python 3.7 (whatever implementation must keep the insertion order). CPython keeps the order since Python 3.6. Pypy even before that.
- user5994461 7y agoA barely legible email dump with 50 concurrent answers is supposed to be the clear official statement? Not to mention that developers just begin migrating to python 3 in 2017 and code still had to work on 2.7 that doesn't order.
- true_religion 7y agoI knew about it, because everyone was talking about it. The origination of the actual information is irrelevant. It was basically interesting gossip for a few weeks.
- anderskaseorg 7y agoThe official release notes for the following release is certainly a clear official statement. https://www.python.org/downloads/release/python-370/ https://www.python.org/downloads/release/python-370/ “The insertion-order preservation nature of dict objects is now an official part of the Python language spec.” (June 27, 2018)
- d0mine 7y agoThe ruling is the very first and only line from the link: > Make it so. "Dict keeps insertion order" is the ruling. Thanks!
- dr_zoidberg 7y agoThere's a great talk by David Beazley[0], which I don't remember its title right now, where he bashes all previous python versions except the latest at the time[1], which was 3.6. And he says "since I'm not a core developer, I can tell you this: rely on dicts being ordered so much that eventually they'll make it official". Guess he "won" in the end ;) [0] Well, he usually gives great talks anyway [1] Alright, he literally started many talks doing that
- DonHopkins 7y agoYes, David Beazley's talks are always wonderful!
- crashbunny 7y agoRaymond Hettinger does or did a few talks on dictionaries too. He covers the history of dictionaries in python and how they evolved. It was mentioned in the article's comment section. https://www.youtube.com/watch?v=p33CVV29OG8 https://www.youtube.com/watch?v=p33CVV29OG8
- jeen02 7y agoWhoa, calm your horses angry boy.
- yvdriess 7y agoThere is no language spec for Python, the CPython implementation defines the language.
- xapata 7y agoThe language reference is a specification for the language. The library reference is a specification for the standard library. https://docs.python.org/3/reference/index.html https://docs.python.org/3/reference/index.html
- takeda 7y agoThat still was announced a while ago. When reading the title I though it was something new (maybe now Python decided to keep the keys sorted? ;)
- jimmaswell 7y ago> rely on it without fearing it can go away with the next release This is Python we're talking about.