[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Documentation of __hash__


I do not understand the following statement from the python (2 and 3) documentation regarding __hash__ and __eq__ methods:
"If a class does not define an __eq__() <> method it should not define a __hash__() <> operation either;?
(see <> )

I thought it relates to the second part (?if it defines __eq__() <> but not __hash__() <>, its instances will not be usable as items in hashable collections?), which is totally clear to me.
But then the implication should be the other way around.

But what is the reason (meaning) for the statement as it is?

Best regards,