[Python-Dev] Python 3.6 dict becomes compact and gets a private version; and keywords become ordered (original) (raw)

Eric Snow ericsnowcurrently at gmail.com
Mon Sep 12 19:01:25 EDT 2016


On Mon, Sep 12, 2016 at 4:46 PM, Ethan Furman <ethan at stoneleaf.us> wrote:

Does anyone have a short explanation of the interaction between hash randomization and this new always ordered dict? Why doesn't one make the other useless?

Before 3.6, dict iteration was based on the hash table, which varies based on the hash seed. The compact dict implementation separates the hash table from the keys table (which preserves insertion order), and iterates over the keys table. So the hash table uses the same hash randomization as before, but it no longer impacts iteration.

-eric



More information about the Python-Dev mailing list