Customizing sequence types
Terry Reedy
tjreedy at udel.edu
Mon Nov 17 14:30:37 EST 2008
Mr.SpOOn wrote:
> It seems that I solved my main problem, but I still have some doubt.
>
> I thought this would work, but I was wrong.
> I had to rewrite __eq__ with the same code of __cmp__
>
> Why it doesn't work with __cmp__ or __hash__ ?
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).
More information about the Python-list
mailing list