[Python-Dev] PEP 468 (Ordered kwargs)

Chris Withers chris at simplistix.co.uk
Wed Jan 28 10:14:21 CET 2015

On 28/01/2015 07:14, Gregory P. Smith wrote:
> It is a potentially bad idea if order is the default behavior of
> iteration, items(), keys() and values(). Ideally order should only be
> exposed when explicitly asked for to help prevent bugs and mitigate
> potential information leaks.

I have to be honest, I think that's the opposite of most new users 

> Experience cleaning up our huge code base at work to turn on hash
> randomization by default a couple years ago has shown that people depend
> on iteration order in code often without intending to. This often leads
> to latent bugs. Keep iteration order unstable by default and you prevent
> people from doing that.

Hmm, well, or you could say that always having ordering would mean the 
behaviour would match new users experimental understanding and so 
eliminate all bugs that occur when people accidentally rely on ordering.

Personally, I'd prefer to see us be explicit about data structures used 
when "security matters", an explicit RandomOrderedDict would make that 



More information about the Python-Dev mailing list