[Python-ideas] An identity dict
Antoine Pitrou
solipsis at pitrou.net
Sun May 30 16:54:08 CEST 2010
On Sun, 30 May 2010 14:27:05 +0000 (UTC)
Benjamin Peterson <benjamin at python.org>
wrote:
> Antoine Pitrou <solipsis at ...> writes:
> > Perhaps it would be more useful to add a generic
> > collections.keyfuncdict, taking a function which applied to a key
>
> Perhaps; I'm only really interested in the identity version. That could be
> specified by keyfuncdict(None, None).
Just keyfuncdict(None) or keyfuncdict(id), then.
I'm not proposing that the hash() and eq() function be passed, but
really a factory function which is used for computing the actual
lookup key when doing inserts and lookups (which then implicitly use
the natural hash and eq functions for that lookup key, as a normal
dict does).
Regards
Antoine.
More information about the Python-ideas
mailing list