Closed eric-wieser closed 5 years ago
This section recommends:
isinstance(x, numbers.Integral) # Python 2, the canonical way isinstance(x, (long, int)) # Python 2 isinstance(x, int) # Python 3, easier to remember
The first of these will work on types like np.int16, whereas your proposed python 3 substitution does not.
np.int16
Hi @eric-wieser, thanks for noting, I definitely didn't think about that (again special case for scalars ... )
This section recommends:
The first of these will work on types like
np.int16
, whereas your proposed python 3 substitution does not.