Search notes:

Python: int

int is one of Python's three built-in numerical types, the other two being float and complex.
An int stores an integral number

Python 3: no minimum or maximum number

With Python 3, there is no maximum or minimum number that can be stored in an int:
>>> i =   12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
>>> print(i* 10**10 + 1234567890)
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
The number of bits that are needed to store a value as int can be queried with bit_length():
>>> print(i.bit_length())
463
>>> zero = 0
>>> print(zero.bit_length())
o
>>> kb = 1024
>>> print(kb.bit_length())
11
>>> almost_kb = kb - 1
>>> print(almost_kb.bit_length())
10
See also

See also

sys.int_info
Other Built-in types such as float.

Index