A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-April/111003.html below:

[Python-Dev] PyObject_RichCompareBool identity shortcut

[Python-Dev] PyObject_RichCompareBool identity shortcut [Python-Dev] PyObject_RichCompareBool identity shortcutGreg Ewing greg.ewing at canterbury.ac.nz
Thu Apr 28 07:40:44 CEST 2011
Steven D'Aprano wrote:
> You can compare NANs, and the result of the 
> comparisons are perfectly well defined by either True or False.

But it's *arbitrarily* defined, and it's far from clear that
the definition chosen is useful in any way.

If you perform a computation and get a NaN as the result,
you know that something went wrong at some point.

But if you subject that NaN to a comparison, your code
takes some arbitrarily-chosen branch and produces a
result that may look plausible but is almost certainly
wrong.

The Pythonic thing to do (in the Python 3 world at least) would
be to regard NaNs as non-comparable and raise an exception.

-- 
Greg
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4