[Python-Dev] Guarantee ordered dict literals in v3.7?

Victor Stinner victor.stinner at gmail.com
Mon Nov 6 03:46:18 EST 2017


2017-11-05 18:50 GMT+01:00 Guido van Rossum <guido at python.org>:
> I don't see this as a reason to not put this into the language spec at 3.7.

It can prevent some kinds of optimizations. Dictionaries are used
"everywhere" in Python, so they are very important for performance.

I would prefer to only keep the ordering warranty for function keyword
arguments and class members, and use explicitly an ordered dictionary
when needed.

Sorry, I don't have any example right now of a concrete optimization
which would not be possible with ordered dictionary. But Serhiy
mentioned the performance impact of ordering in Python 3.6 dictionary
on deletion.

Victor


More information about the Python-Dev mailing list