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

Chris Angelico rosuav at gmail.com
Mon Sep 12 12:51:29 EDT 2016


On Tue, Sep 13, 2016 at 2:27 AM, Gregory P. Smith <greg at krypto.org> wrote:
> Disorder for this purpose need not be a random shuffle (overkill). It just
> needs to be regularly inconsistent. A simple thing to do on top of 3.6's new
> dict implementation would be to pick a random starting point within the
> order array rather than offset 0 to start iteration from. That small change
> would be sufficient to guarantee that code depending on order must ask for
> order. It could even allow us to get people ready for iteration within the
> same process to become unstable.

Don't forget that .items(), .keys(), and .values() are all
synchronized, so you'd probably have to pick an offset at dict
creation and run with it forever after.

ChrisA


More information about the Python-Dev mailing list