[Python-ideas] An identity dict
Lie Ryan
lie.1296 at gmail.com
Sun May 30 16:56:32 CEST 2010
On 05/31/10 00:23, Benjamin Peterson wrote:
> 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.
mydict[id(key)] = (key, value)
>> 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.
it may be useful, but if you can emulate it relatively easily with
regular dict, why bother with a new type?
More information about the Python-ideas
mailing list