[dictionary] how to get key by item
Skip Montanaro
skip at pobox.com
Tue Dec 14 10:05:26 EST 2004
Fredrik> Skip Montanaro wrote:
>> That doubles your storage
Fredrik> careful: it creates another dictionary structure with the same
Fredrik> size as the first one, but it doesn't copy the objects in the
Fredrik> dictionary.
Yes, sorry. The OP indicated the original dictionary was very big, so it
seemed like duplicating the dictionary storage would potentially be costly
since dictionaries hold extra storage (on average, twice the storage needed
to hold the references to its keys?) to support O(1) average time lookup.
Skip
More information about the Python-list
mailing list