Numeric comparison anomaly

Piet van Oostrum piet at
Thu Feb 20 22:32:17 CET 2003

>>>>> sismex01 at (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>
Private email: P.van.Oostrum at

More information about the Python-list mailing list