Numeric comparison anomaly

Piet van Oostrum piet at cs.uu.nl
Sat Feb 22 12:08:51 EST 2003


>>>>> Gary Herron <gherron at islandtraining.com> (GH) wrote:

GH> Actually, Python's > *is* an ordering, but he is *not* using 
GH> python's > operator.  He has redefined it (in a silly fashion)
GH> with the __cmp__ method.

What I meant is that, if you use '>', you usually expect it to have the
properties of an ordering. That implementation did not have that property.
Most people probably even expect it to be a total ordering.
And nom Python's > is *not* an ordering, at least not for general objects.
It is possible to have a > b > a for certain objects a and b.
-- 
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