[python] What is inf and nan?

You say:

when i do nan - inf i dont get -inf i get nan

This is because any operation containing NaN as an operand would return NaN.

A comparison with NaN would return an unordered result.

>>> float('Inf') == float('Inf')
True
>>> float('NaN') == float('NaN')
False