[Python-Dev] the new(-ish) dict ordering vs hash randomization

Petr Viktorin encukou at gmail.com
Mon Jun 18 09:27:34 EDT 2018

On 06/18/18 15:13, Ethan Furman wrote:
> I'm sure we've already had this conversation, but my google-fu is 
> failing me.
> Can someone provide a link to a discussion explaining why the new 
> ordering of dictionaries does not defeat the hash-randomization 
> non-ordering we added a few versions ago?

Modern dicts have an array of contents (which is used for iterating the 
dict, and thus iteration doesn't touch hashes at all), and a separate 
hash table of indexes (which still enjoys the benefits of hash 

See Raymond Hettinger's initial post from 2012: 

A technical overview of the idea is on the PyPy blog:

More information about the Python-Dev mailing list