hashing mutable instances
Michael Hudson
mwh at python.net
Fri Oct 31 07:26:03 EST 2003
Thomas Heller <theller at python.net> writes:
> Alex Martelli <aleax at aleax.it> writes:
>
> [about object.__hash__]
> > Bernhard Herzog wrote:
> > ...
> >> Good question. I didn't know that that was the default implementation of
> >> __hash__. It's not documented AFAICT, but it does seem to be the case. I
> >
> > I don't know why the official docs don't mention this fact -- I do
> > mention it in "Python in a Nutshell", of course (p. 132).
> >
> >> wonder why, even though it's useful.
> >
> > The reason this is done is because it's useful.
>
> Well, Guido seems to disagree. Per his request, when I complained about
> the default __hash__() method he asked me to enter a bug about it:
> http://www.python.org/sf/660098. But it doesn't seem easy at all to fix
> this...
That's actually something different: new-style classes that define
__eq__ remain hashable. I don't think making new-style classes that
*don't* define __eq__ *un*hashable is on the table, is it? If it is,
let me complain about that :-)
Cheers,
mwh
--
The proponent of the PEP shall be placed in a gladiatorial arena
together with half a dozen hungry lions, and permitted to debate
the merits of the proposal with them.
-- Greg Ewing, comp.lang.python
More information about the Python-list
mailing list