[Python-ideas] An identity dict
Benjamin Peterson
benjamin at python.org
Mon May 31 00:17:59 CEST 2010
M.-A. Lemburg <mal at ...> writes:
> Are you sure this is a good idea for the stdlib ?
>
> id(obj) gives you the current storage address of an object
> in CPython and these can be reused over time.
But since the dictionary will hold a reference to the key, it won't be reused.
> For experts, such a dictionary may have some value (e.g. to
> work around the hash() requirement of normal dictionaries),
> but I feel that newbies would have a hard time understanding
> all the implications.
I'm not proposing a dictionary that would not hold a reference to its keys.
More information about the Python-ideas
mailing list