
May 30, 2010
10:17 p.m.
M.-A. Lemburg <mal@...> 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.