[Python-ideas] An identity dict
benjamin at python.org
Wed Jun 2 19:42:38 CEST 2010
Raymond Hettinger <raymond.hettinger at ...> writes:
> Also, there hasn't been much discussion of implementation,
> but unless you're willing to copy and paste most of the
> code in dictobject.c, you're going to end-up with something
> much slower than d[id(obj)]=value.
A slightly hacky way to implement this on CPython without copying much would be
to implement __getitem__, and __setitem__ in C and subclass it in Python to call
those methods in the rest of dictionary implementation.
More information about the Python-ideas