Customizing sequence types
tjreedy at udel.edu
Mon Nov 17 20:30:37 CET 2008
> 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