30 May
2010
30 May
'10
10:35 a.m.
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.