[Python-ideas] Disallow orderring comparison to NaN

Alexander Belopolsky alexander.belopolsky at gmail.com
Thu Apr 28 17:02:09 CEST 2011


On Thu, Apr 28, 2011 at 10:22 AM, Mike Graham <mikegraham at gmail.com> wrote:
> On Thu, Apr 28, 2011 at 4:52 AM, Alexander Belopolsky
> <alexander.belopolsky at gmail.com> wrote:
..
>>> Since py3k has already made None < 0 an error, it may be reasonable
>>> for float('nan') < 0 to raise an error as well (probably ValueError
>>> rather than TypeError).  This will not make lists with nans sortable
>>> or searchable using binary search, but will make associated bugs
>>> easier to find.
>
> I'm -0 on this -- I really favor having NaNs behave like NaNs.

.. but IEEE 754 specifies that NaNs compare as "unordered".



More information about the Python-ideas mailing list