Numeric comparison anomaly
Piet van Oostrum
piet at cs.uu.nl
Thu Feb 20 16:32:17 EST 2003
>>>>> sismex01 at hebmex.com (S) wrote:
S> If __cmp__() returns 1, then "inf == inf" can't ever be true,
S> because __cmp__() is actually saying that it's larger.
Yes, of course, but I mean that I consider this an incorrect
definition of __cmp__.
class A:
def __cmp__(self, other):
return self is not other
would be better.
--
Piet van Oostrum <piet at cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: P.van.Oostrum at hccnet.nl
More information about the Python-list
mailing list