def isnum(x):
 for T in (int, float, complex):
  if isinstance(x, T):
   return 1
 return 0

def isnum ( x ) : for T in ( int , float , complex ) : if isinstance ( x , T ) : return 1 return 0
test whether an object is an instance of a built-in numeric type .