[Python-ideas] An identity dict

Benjamin Peterson benjamin at python.org
Sun May 30 17:20:41 CEST 2010


Lie Ryan <lie.1296 at ...> writes:
> it may be useful, but if you can emulate it relatively easily with
> regular dict, why bother with a new type?

Why defaultdict then? It can be implemented just fine with dict.setdefault.
identitydict avoids the unnatural method of having the key and value as value of
the dictionary, resulting in contortions everytime the dictionary is manipulated.







More information about the Python-ideas mailing list