[Python-Dev] Algoritmic Complexity Attack on Python

Guido van Rossum guido@python.org
Mon, 02 Jun 2003 09:37:56 -0400


> For Python 3 I hope we (you) can consider another line of
> flexibility too: sometimes when I build a hash table, I want an
> __eq__ that isn't "the natural" __eq__ for the key objects.  For
> example, using a dict to partition objects by equivalence class
> wants to use the equivalence relation of interest at the moment.
> This implies a specific dict may want to use a "non-standard"
> __hash__ too.  Hiding the real objects in wrapper objects works for
> this purpose, of course, but sometimes it would be a lot more
> convenient to pass hash and eq functions to a dict's constructor.

Couldn't you write a dict-like class that does the wrapping for you?
I'm worried that adding such flexibility to dict will slow down the
common case.

--Guido van Rossum (home page: http://www.python.org/~guido/)