5.2. Integers

Python has two types of integers. Plain integers are the generic vanilla (32-bit) integers recognized on most systems today. Python also has a long integer size; however, these far exceed the size provided by C longs. We will take a look at both types of Python integers, followed by a description of operators and built-in functions applicable only to Python integer types.

5.2.1. (Plain) Integers

Python's “plain” integers are the universal numeric type. Most machines (32-bit) running Python will provide a range of -231 to 231-1, that is -2,147,483,648 to 2,147,483,647. Here are some examples of Python integers:

0101   84   -237   0x80   017   -680   -0X92

Python integers are implemented as (signed) longs in C. Integers are normally represented ...

Get Core Python Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.