Message221781
> (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. |
|
Date |
User |
Action |
Args |
2014-06-28 12:22:33 | akira | set | recipients:
+ akira, rhettinger, mark.dickinson, Electro |
2014-06-28 12:22:33 | akira | set | messageid: <1403958153.17.0.255455798223.issue21873@psf.upfronthosting.co.za> |
2014-06-28 12:22:33 | akira | link | issue21873 messages |
2014-06-28 12:22:32 | akira | create | |
|