[SciPy-user] Re: nan puzzle

Grant Edwards grante at visi.com
Thu Jul 14 09:16:13 CDT 2005

On 2005-07-14, Robert Kern <rkern at ucsd.edu> wrote:

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

Ah, I missed that.  That is rather odd. 

> 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.  :-)

After many, many years of having to impliment stuff like that
myself in C, it's hard to get into the habit of looking around
for a pre-existing implimentation.  It turns out there are a
couple different Python modules that include an isnan()
function, and even Gnu libc now comes with one.

Apparently the world is waking up to the usefulness of NaN's.

Grant Edwards                   grante             Yow!  Hand me a pair of
                                  at               leather pants and a CASIO
                               visi.com            keyboard -- I'm living
                                                   for today!

More information about the SciPy-user mailing list