[Python-Dev] Rich comparisons shortcut (original) (raw)

Jewett, Jim J jim.jewett at eds.com
Tue Mar 30 16:11:31 EST 2004


Version 2.215 (Mar 21, 2004) of object.c assumes that identity implies equality.

I won't rehash the discussion about custom objects and NaN. I do think the decision should be reasonably consistent. The current CVS version shortcuts for == and !=, but not for the other operators.

Normally,

x == y implies 
    x <= y
    x >= y
    not x < y
    not x > y 

(in addition to) not x != y

I think any object that intentionally violates these rules is likely to also violate the (is implies ==) assumption.

-jJ



More information about the Python-Dev mailing list