Indeed the usual definition of isnan reads:
def isnan(x):
return x != x