[Python-ideas] An identity dict

Benjamin Peterson benjamin at python.org
Sun May 30 16:23:02 CEST 2010


Lie Ryan <lie.1296 at ...> writes:
> what's wrong with dict[id(key)] = foo?

For one, you can't get the value of the key out of the dict.


> that their id() is expensive is implementation details, and the
> developer of PyPy should solve that instead of adding a clutch to the
> stdlib.

A "clutch"? Even ignoring PyPy, an identitydict is still a useful primitive.







More information about the Python-ideas mailing list