[Numpy-discussion] trouble with bool_

Alan G Isaac aisaac at american.edu
Thu May 6 16:40:17 EDT 2010


What information exactly is `isnan` supposed to communicate?
Put another way, given that it raises NotImplemented for unknown types,
and that bool(NotImplemented) is True, is there a reason by it cannot
return a Python bool (which seems more useful)?
Thanks,
Alan Isaac


> >> np.isnan(np.nan)
True
> >> np.isnan(np.nan) is True
False
> >> type(np.isnan(np.nan))
<type 'numpy.bool_'>
> >> np.isnan('')
NotImplemented
> >> bool(_)
True
> >> if np.isnan(''): print "Uh oh"
...
Uh oh




More information about the NumPy-Discussion mailing list