[Python-ideas] An identity dict

Masklinn masklinn at masklinn.net
Sun May 30 12:35:42 CEST 2010


On 2010-05-30, at 11:07 , Lie Ryan wrote:
> 
>> An advantage of formalizing this in collections would be to enable other Python
>> implementations like PyPy, where id() is expensive, to provide an optimized
>> identitydict.
> 
> that their id() is expensive is implementation details, and the
> developer of PyPy should solve that instead of adding a clutch to the
> stdlib.

Actually, I'd say the exact opposite: CPython's identity being cheap is an
implementation detail, not the other way around, and that is what shouldn't
be relied on. In that light, a special-purpose identity dictionary independent
from implementation-specific and artificially low id() computation costs is a
pretty good idea.


More information about the Python-ideas mailing list