Customizing sequence types

Mr.SpOOn mr.spoon21 at gmail.com
Mon Nov 17 19:04:43 EST 2008


On Mon, Nov 17, 2008 at 8:30 PM, Terry Reedy <tjreedy at udel.edu> wrote:
> Sets and dicts use __hash__ and __eq__ together, as documented.
>
> "If a class does not define an __eq__() method it should not define a
> __hash__() operation either;" (3.0 manual, but same earlier).

Well, maybe, but in the docs, for the __hash__ method I read:

"If a class does not define a __cmp__() method it should not define a
__hash__() operation either;"

>From here: http://www.python.org/doc/2.5.2/ref/customization.html



More information about the Python-list mailing list