Re:Python dicts are now ordered
by squeaky-clean on Friday February 07, 2020 @02:43PM
(#22270006)
There'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.
BDFL 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/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.
Re:Python dicts are now ordered
by user5994461 on Friday February 07, 2020 @05:01PM
(#22271490)
A 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.
Re:Python dicts are now ordered
by anderskaseorg on Friday February 07, 2020 @05:12PM
(#22271632)
The official release notes for the following release is certainly a clear official statement.
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)
Re:Python dicts are now ordered
by true_religion on Friday February 07, 2020 @05:03PM
(#22271522)
I 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.
The ruling is the very first and only line from the link:
> Make it so. "Dict keeps insertion order" is the ruling. Thanks!
Re:Python dicts are now ordered
by dr_zoidberg on Friday February 07, 2020 @07:19PM
(#22272632)
There'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
Re:Python dicts are now ordered
by crashbunny on Saturday February 08, 2020 @08:35AM
(#22275630)
Raymond 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.
Re:Python dicts are now ordered
by DonHopkins on Friday February 07, 2020 @09:31PM
(#22273392)
Yes, David Beazley's talks are always wonderful!
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".