[Python-ideas] [Python-Dev] Why is nan != nan?

Mark Dickinson dickinsm at gmail.com
Sat Mar 27 14:22:54 CET 2010


On Sat, Mar 27, 2010 at 12:39 PM, Mark Dickinson <dickinsm at gmail.com> wrote:
> <python-ideas-territory>
>
> How about default behaviour like the above, with a "from __options__
> import non-stop-arithmetic" for people who want 1./0. to give infinity
> and sqrt(-1) to give nan?

Hmm.  That would be a horrible way to control the option.  But the
idea's the same:  give some  way to enable non-stop arithmetic.

Some sort of context manager might make sense:

with non_stop_arithmetic:
    result = calculation()
if isnan(result):
    ...


Mark



More information about the Python-ideas mailing list