New submission from Mak Nazečić-Andrlon:

While searching for a way to work around the breakage of the Schwartzian 
transform in Python 3 (and the resulting awkwardness if you wish to use heapq 
or bisect, which do not yet have a key argument), I thought of the good old 
IEEE-754 NaN. Unfortunately, that shouldn't work since lexicographical 
comparisons shouldn't stop for something comparing False all the time. 
Nevertheless:

>>> (1, float("nan"), A()) < (1, float("nan"), A())
False
>>> (0, float("nan"), A()) < (1, float("nan"), A())
True

Instead of as in
>>> nan = float("nan")
>>> (1, nan, A()) < (1, nan, A())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unorderable types: A() < A()

(As a side note, PyPy3 does not have this bug.)

----------
components: Interpreter Core
messages: 221600
nosy: Electro
priority: normal
severity: normal
status: open
title: Tuple comparisons with NaNs are broken
versions: Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21873>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to