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.maxint contains the maximum value a Python int can hold.
    • On a 64-bit Python 2.7, the size is 24 bytes. Check with sys.getsizeof().
  • Python 3: sys.maxsize contains 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.
Answer from Ignacio Vazquez-Abrams on Stack Overflow
🌐
Python
peps.python.org › pep-0237
PEP 237 – Unifying Long Integers and Integers | peps.python.org
February 1, 2025 - Python currently distinguishes between two kinds of integers (ints): regular or short ints, limited by the size of a C long (typically 32 or 64 bits), and long ints, which are limited only by available memory.
🌐
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.
🌐
Medium
mike-vincent.medium.com › quarks-outlines-python-long-integers-3d41b1f0681f
Quark’s Outlines: Python Long Integers | by Mike Vincent | Medium
August 4, 2025 - In many languages, numbers stop at a maximum value. When the number gets too big, the result is an error or wraps around to zero. In Python, this does not happen. Python long integers grow as large as needed, limited only by memory.
🌐
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.
🌐
Quora
quora.com › How-do-I-declare-long-integers-in-Python
How to declare long integers in Python - Quora
Answer (1 of 4): 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 int altogether and only having long. Python 2: [code ]sys.maxint[/code] contains the maximum value a Python int can hol...
🌐
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.
🌐
Python
docs.python.org › 3 › c-api › long.html
Integer Objects — Python 3.14.7 documentation
Macro for creating a Python integer from a process identifier. This can be defined as an alias to PyLong_FromLong() or PyLong_FromLongLong(), depending on the size of the system’s PID type.
Find elsewhere
🌐
Educative
educative.io › answers › how-python-implements-super-long-integers
How Python implements super-long integers
In Python, long integers (also known as "arbitrary-precision integers" or "bignums") are implemented using a variable-length integer representation. You can work with extremely large integers without worrying about overflow issues.
🌐
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.
🌐
Rip Tutorial
riptutorial.com › long vs. int
Python Language Tutorial => long vs. int
In Python 2, any integer larger than a C ssize_t would be converted into the long data type, indicated by an L suffix on the literal.
🌐
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.