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

Tim Peters tim.peters at gmail.com
Mon Sep 12 13:16:35 EDT 2016


[Guido]

Wouldn't attempting to reuse DUMMY entries be expensive? You'd have to search forward in the array. Just keeping a count of DUMMY entries and compacting when there are too many seems better somehow.

I haven't looked at the code, but presumably one of the members of a DUMMY key/value struct could be (ab)used to hold the index of "the next" DUMMY (i.e., treating DUMMYs as a stack implemented by a singly-linked list). In which case no search is needed, but the dict would need a word to hold the index of the DUMMY stack top (or, e.g., -1 when no DUMMY exists) - or dedicate "the first" key/value slot to holding the stack top - or ...

It's just code, so it can do anything ;-)



More information about the Python-Dev mailing list