Identity dictionnary

Jeff Epler jepler at
Sun Feb 29 16:42:18 CET 2004

You might consider defining a mapping which appears to be {item: value}
but is internally {hash(item): (item, value)}.  You might be able to
subclass dict or start with UserDict to do this.  This will certainly
avoid the problem of ever calling item.__eq__ when doing an operation on
the map, without relying on stuff that is poorly documented at best and
implementation-specific or just plain unreliable at worst.


More information about the Python-list mailing list