[Python-ideas] Disallow orderring comparison to NaN
Alexander Belopolsky
alexander.belopolsky at gmail.com
Fri Apr 29 17:57:14 CEST 2011
On Fri, Apr 29, 2011 at 3:30 AM, Stephen J. Turnbull <stephen at xemacs.org> wrote:
> Rob Cliffe writes:
>
> > True. But why be forced to walk on eggshells when writing a perfectly
> > ordinary bit of code that "ought" to work as is?
>
> What makes you think *anything* "ought" to "work" in the presence of
> NaNs?
There are different shades of "not working". In most cases, raising
an exception is preferable to silently producing garbage or entering
an infinite loop. NaNs are unordered and NaN < 0 makes as much sense
as None < 0 or "abc" < 0. The later operations raise an exception in
py3k.
More information about the Python-ideas
mailing list