NaN:
In python you can declare 'nan' as a float.Inf:
When you try print(1E650), it returns inf. In python, variable x can be checked for 'inf' using math.isinf(x)
For more on 'nan' and 'inf' refer PEP 754.
"Ramblings on computational chemistry, in silico experiments and programming in python 3.x"