If you want to check with no regard for Python version (2.x vs 3.x), use six (PyPI) and it's integer_types
attribute:
import six
if isinstance(obj, six.integer_types):
print('obj is an integer!')
Within six
(a very light-weight single-file module), it's simply doing this:
import sys
PY3 = sys.version_info[0] == 3
if PY3:
integer_types = int,
else:
integer_types = (int, long)