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

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?

Hi, 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 randomization).

See Raymond Hettinger's initial post from 2012: https://mail.python.org/pipermail/python-dev/2012-December/123028.html

A technical overview of the idea is on the PyPy blog: https://morepypy.blogspot.com/2015/01/faster-more-memory-efficient-and-more.html



More information about the Python-Dev mailing list