[Python-ideas] An identity dict
Lie Ryan
lie.1296 at gmail.com
Sun May 30 13:14:14 CEST 2010
On 05/30/10 20:35, Masklinn wrote:
> 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.
the performance of any Python statement/function is implementation
detail. Whether any statement/function is fast or cheap shouldn't be
relied on. IMHO, adding a brand new collection module just because a
Python implementation has a fast/cheap operations isn't a good reason.
More information about the Python-ideas
mailing list