Checking whether a variable is an integer or not

If you need to do this, do unless you are in Python 2.x in which case you want Do not use type. It is almost never the right answer in Python, since it blocks all the flexibility of polymorphism. For instance, if you subclass int, your new class should register as an int, which type will not do: This adheres … Read more