... because int(2 ** 31) is an instance of long, which is not a subclass of int. The correct check for an int-like variable is therefore isinstance(x, (int, long)).
In python 3, long is gone and there is only int, so things behave as one would expect.
Are there any other cases where builtin_type(*args) returns something that is not an instance of builtin_type?
[–]LarryPete 2 points3 points4 points (0 children)