NaN handling

Ivan Vinogradov vinogri at mcmaster.ca
Fri May 5 22:37:22 CEST 2006


> <snip>
> NaNs are handled.

Throwing an exception would be nice in regular Python (non-scipy).

This works to catch NaN on OSX and Linux:

# assuming x is a number
if x+1==x or x!=x:
	#x is NaN

But is expensive as a precautionary measure.
Assert can be used for testing, if production code can be run with -0  
or -OO.



More information about the Python-list mailing list