[SciPy-user] nan puzzle

Robert Kern rkern at ucsd.edu
Tue Jul 12 21:04:22 CDT 2005


Alan G Isaac wrote:
> Is this expected behavior?
> Thank you,
> Alan Isaac
> 
>>>>z=[0,1,nan]
>>>>x=nan
>>>>x
> 
> -1.#IND
> 
>>>>x is nan
> 
> True
> 
>>>>x=z[2]
>>>>x
> 
> -1.#IND
> 
>>>>x is nan
> 
> False

Platform-dependent accident, as Tim Peters is fond of saying.

On my Powerbook:

In [1]: z = [0, 1, nan]

In [2]: x = nan

In [3]: x is nan
Out[3]: True

In [4]: z[2] is nan
Out[4]: True

In [5]: x = z[2]

In [6]: x is nan
Out[6]: True

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter



More information about the SciPy-user mailing list