I'm having an issue with isinstance()
.
I'm using Python 2.7.8, and running scripts from the shell.
The array
element I'm testing for contains a number, but this function returns false; using number.Numbers
:
import numbers
...
print array[x][i]
>> 1
...
print isinstance(array[x][i], numbers.Number)
>>> False
Also tried this, from this post
import types
...
print isinstance(array[x][i], (types.IntType, types.LongType, types.FloatType, types.ComplexType))
>>> False
From the same post, I tried
isinstance(array[x][i], (int, float, long, complex))
I also tried this solution did not work.
All return false.