in python 2.6 , 2.7 use
isinstance(variable, (int, long))
in python 3x ints , longs merged.
isinstance(variable, int)
is there clean version agnostic way of testing if variable integer in python?
from 2.6 can use numbers.integral:
if isinstance(var, numbers.integral): pass # whatever
Comments
Post a Comment