[Python-Dev] Ordering keyword dicts

Barry Warsaw barry at python.org
Mon May 20 15:39:45 CEST 2013

On May 20, 2013, at 02:30 PM, Armin Rigo wrote:

>Just checking: in view of Raymond's proposal, is there a good reason
>against  having all dicts be systematically ordered?  It would
>definitely improve the debugging experience, by making multiple runs
>of the same program more like each other, instead of depending on the
>random address-based ordering.  (Performance-wise, I guess it might be
>a little bit slower or faster depending on cache issues and so on, but
>the emphasis I'd put is on the "little bit".)

I'm ambivalent on the proposal -- I could get behind it if it was demonstrably
*not* a performance hit (I'm already fighting enough "Python is too slow"

However, if such a change were made, I think it must be adopted as a change
to the language specification.  Meaning, if dicts (or even just keyword
arguments) are to be ordered, it can't be as a side-effect of the
implementation.  We've had a lot of churn getting code and tests to the point
where most libraries have adjusted to the undefined order of dictionary
iteration.  I don't want to go back to the situation where lots of implicit
ordering assumptions caused broken code when run in one implementation or

Or in other words, if dicts are to be ordered, let's make it an explicit
language feature that we can measure compliance against.


More information about the Python-Dev mailing list