[SciPy-user] Re: nan puzzle

Grant Edwards grante at visi.com
Tue Jul 12 23:16:35 CDT 2005

On 2005-07-13, Alan G Isaac <aisaac at american.edu> wrote:

> Is this expected behavior?

>>>> x is nan
> True
>>>> x=z[2]
>>>> x
> -1.#IND
>>>> x is nan
> False

May I ask why you care?  

The expression "x is nan" seems pretty useless to me.  The "is"
operator isn't really useful for other floating point values,
why would it be useful for nans?

>>> x = 1.234
>>> x is 1.234
>>> y = 1.234
>>> x is y
>>> x == y

What you probably want to be checking is if x has a nan value,
not whether x is the same object as some other object that
has a nan value.

Grant Edwards                   grante             Yow!  Is this my STOP??

More information about the SciPy-user mailing list