Planning a Python Course for Beginners

Gregory Ewing greg.ewing at canterbury.ac.nz
Thu Aug 10 19:14:08 EDT 2017


Python wrote:
> Marko Rauhamaa wrote:
> 
>> id() is actually an ideal return value of __hash__(). The only criterion
>> is that the returned number should be different if the __eq__() is
>> False. That is definitely true for id()
> 
> nan is a clear, simple, undeniable counterexample to that claim.

It's a counterexample to the claim that id() *must* be different if
__eq__() is False, but that's not the claim that was made. The
claim was that it *should* be different, which allows for the
possibility that it might not be different.

(I'll put away my hairsplitting axe and go away now.)

-- 
Greg



More information about the Python-list mailing list