This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author akira
Recipients Electro, akira, mark.dickinson, rhettinger
Date 2014-06-28.12:22:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1403958153.17.0.255455798223.issue21873@psf.upfronthosting.co.za>
In-reply-to
Content
> (a, b) < (c, d) is more like: if a != c: return a < c ...

except CPython behaves (undocumented?) as:

  b < d if a is c or a == c else a < c

the difference is in the presence of `is` operator (identity
comparison instead of `__eq__`). `nan is nan` therefore `b < d` is
called and raises TypeError for `(nan, A()) < (nan, A())` expression
where `a = c = nan`, `b = A()`, and `d = A()`.

But `(float("nan"), A()) < (float("nan"), A())` is False (no
TypeError) because `a is not c` in this case and `a < c` is called
instead where `a = float('nan')`, `b = A()`, `c = float('nan')`, and
`d = A()`. Plus `(a, b) < (c, d)` evaluation is lazy (undocumented?)
i.e., once `a < c` determines the final result `b < d` is not called.
History
Date User Action Args
2014-06-28 12:22:33akirasetrecipients: + akira, rhettinger, mark.dickinson, Electro
2014-06-28 12:22:33akirasetmessageid: <1403958153.17.0.255455798223.issue21873@psf.upfronthosting.co.za>
2014-06-28 12:22:33akiralinkissue21873 messages
2014-06-28 12:22:32akiracreate