[Numpy-discussion] What is the logical value of nan?

Sturla Molden sturla at molden.no
Wed Mar 11 08:12:04 EDT 2009


Charles R Harris wrote:
> It isn't 0 so it should be True. Any disagreement?... Chuck
NaN is not a number equal to 0, so it should be True?

NaN is not a number different from 0, so it should be False?

Also see Pearu's comment.

Why not raise an exception when NaN is evaluated in a boolean context? 
bool(NaN) has no obvious interpretation, so it should be considered an 
error.

Sturla Molden











More information about the NumPy-Discussion mailing list