[SciPy-user] Re: nan puzzle

Robert Kern rkern at ucsd.edu
Wed Jul 13 22:53:34 EDT 2005


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

>>Anyway, now I cannot replicate the problem.
> 
> I still don't understand what the problem is (or was).

His original code had

 >>> z = [0, 1, nan]
 >>> x = z[2]
 >>> x is nan
False

Since "is" evaluates based on pointer comparisons and putting something 
in a list or extracting it again by indexing ought to preserve those 
pointers, that result shouldn't happen for any object, nan or otherwise.

Of course, "x is nan" is a pretty useless operation as you point out, 
and one really should be using some kind of isnan() function. Preferably 
implemented by someone other than one's self.  :-)

-- 
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