def isintlike(x):
 if (not isscalarlike(x)):
  return False
 try:
  return bool((int(x) == x))
 except (TypeError, ValueError):
  return False

def isintlike ( x ) : if ( not isscalarlike ( x ) ) : return False try : return bool ( ( int ( x ) == x ) ) except ( TypeError , ValueError ) : return False
is x appropriate as an index into a sparse matrix? returns true if it can be cast safely to a machine int .