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

Sturla Molden sturla@molden...
Wed Mar 11 07:12:04 CDT 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