[dictionary] how to get key by item

Fredrik Lundh fredrik at pythonware.com
Tue Dec 14 09:11:22 CET 2004

Skip Montanaro wrote:

> That doubles your storage

careful: it creates another dictionary structure with the same size as the first
one, but it doesn't copy the objects in the dictionary.

so whether it doubles the actual memory usage depends on what data you
have in the dictionary (last time I checked, ints and dictionary slots were the
same size, but I cannot think of any other object that isn't larger...)

(but you knew that, of course)


More information about the Python-list mailing list