int and long were "unified" a few versions back. Before that it was possible to overflow an int through math ops.
3.x has further advanced this by eliminating long altogether and only having int.
- Python 2:
sys.maxintcontains the maximum value a Python int can hold.- On a 64-bit Python 2.7, the size is 24 bytes. Check with
sys.getsizeof().
- On a 64-bit Python 2.7, the size is 24 bytes. Check with
- Python 3:
sys.maxsizecontains the maximum size in bytes a Python int can be.- This will be gigabytes in 32 bits, and exabytes in 64 bits.
- Such a large int would have a value similar to 8 to the power of
sys.maxsize.
Top answer 1 of 9
182
int and long were "unified" a few versions back. Before that it was possible to overflow an int through math ops.
3.x has further advanced this by eliminating long altogether and only having int.
- Python 2:
sys.maxintcontains the maximum value a Python int can hold.- On a 64-bit Python 2.7, the size is 24 bytes. Check with
sys.getsizeof().
- On a 64-bit Python 2.7, the size is 24 bytes. Check with
- Python 3:
sys.maxsizecontains the maximum size in bytes a Python int can be.- This will be gigabytes in 32 bits, and exabytes in 64 bits.
- Such a large int would have a value similar to 8 to the power of
sys.maxsize.
2 of 9
25
This PEP should help.
Bottom line is that you really shouldn't have to worry about it in python versions > 2.4
Python Integer Data Type - YouTube
64. Integers Come in All Sizes: Hackerrank | Python Solution ...
03:15
how to declare long int in python - YouTube
16:19
7. Python Integer Data Type - Python Tutorial for Absolute Beginners ...
06:58
python long int range - YouTube
05:01
How does Python manage int and long? - YouTube
Tutorialspoint
tutorialspoint.com › python › python-long-function.htm
Python long() Function
The long() function from Python 2 has been deprecated in Python 3. Instead, Python 3 uses the built-in int() function, which can handle arbitrarily large integers.
Wikibooks
en.wikibooks.org › wiki › Python_Programming › Numbers
Python Programming/Numbers - Wikibooks, open books for an open world
Int: The basic integer type in python, equivalent to the hardware 'c long' for the platform you are using in Python 2.x, unlimited in length in Python 3.x.
Readthedocs
portingguide.readthedocs.io › en › latest › numbers.html
Numbers — Conservative Python 3 Porting Guide 1.0 documentation
The long builtin no longer exists. In Python 2, calling int on a number that doesn’t fit in the machine int range would automatically create a long with the appropriate value.
DEV Community
dev.to › mike-vincent › quarks-outlines-python-long-integers-36nl
Quark’s Outlines: Python Long Integers - DEV Community
August 4, 2025 - Problem: You want to calculate 9999 ** 1234, but you worry that the number will break your program. Solution: Python can compute and store the result using long integers, even if it has thousands of digits. Python lets you multiply large values without losing digits using long integers.
Arpit Bhayani
arpitbhayani.me › home › blogs › systems internals › how python handles gigantic integers
How Python Handles Gigantic Integers
January 10, 2020 - Python, in order to keep things efficient implements the Karatsuba algorithm that multiplies two n-digit numbers in O( nlog23) elementary steps. The algorithm is slightly complicated is out of the scope of this article but you can find its implementation in k_mul and k_lopsided_mul functions in file longobject.c. All operations on integers are defined in the file longobject.c and it is very simple to locate and trace each one.
UC Berkeley Statistics
stat.berkeley.edu › ~spector › extension › python › notes › node22.html
Types of Numeric Data
To specify a floating point number, ... always stored as floating point, even if there is no decimal point. Long integers can be entered by following an ordinary integer with the letter ``L'', either lowercase (e.g....
GeeksforGeeks
geeksforgeeks.org › python › what-is-the-maximum-possible-value-of-an-integer-in-python
What is the maximum possible value of an integer in Python ? - GeeksforGeeks
July 23, 2025 - Thus we never need any special arrangement for storing large numbers (Imagine doing above arithmetic in C/C++). As a side note, in Python 3, there is only one type "int" for all type of integers. In Python 2.7. there are two separate types "int" (which is 32 bit) and "long int" that is same as "int" of Python 3.x, i.e., can store arbitrarily large numbers.
Codementor
codementor.io › community › how python implements super long integers?
How python implements super long integers? | Codementor
January 10, 2020 - Python, in order to keep things efficient implements the Karatsuba algorithm that multiplies two n-digit numbers in O ( nˡᵒᵍ³ ) elementary steps. The algorithm is slightly complicated is out of the scope of this article but you can find its implementation in k_mul and k_lopsided_mul functions in file longobject.c. All operations on integers are defined in the file longobject.c and it is very simple to locate and trace each one.
Python Course
python-course.eu › material › course › html › text19.html
Number Data Types and Literals
Long Integer If an integer literal ends with an l or L, it becomes a Python long integer. It can grow as “long” as needed. Since Python 2.2. the letter “l” or “L” is no longer needed, as integers are automatically converted to long integers on overflow.
CodeRivers
coderivers.org › blog › python-long-int
Python Long Int: An In - Depth Exploration - CodeRivers
February 22, 2026 - Now, the int type in Python 3 can represent integers of arbitrary size. There is no fixed upper limit on the magnitude of an integer, limited only by the available memory. In Python, you can declare a long integer just like you would a regular integer.