On May 30, 2010, at 7:56 AM, Lie Ryan wrote:
On 05/31/10 00:23, Benjamin Peterson wrote:
Lie Ryan <lie.1296@...> writes:
what's wrong with dict[id(key)] = foo?
. . .
it may be useful, but if you can emulate it relatively easily with
regular dict, why bother with a new type?
I agree that this would be a waste.
Also, I haven't seen much of a discussion of use cases.
It's been possible to make identity dictionaries for a very
long time, yet I can't remember the last time I saw one used.
The Python language makes very few guarantees about
object identity so it is mainly only usable in a few circumstances
where an object is continually referenced by something outside
the identity dict.
I would like to see an identity dict posted an ASPN recipe
to see if anyone actually uses it.
Raymond