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
🌐
Tutorialspoint
tutorialspoint.com › python › python-long-function.htm
Python long() Function
The long() function from Python 2 has been deprecated in Python 3.
🌐
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.
🌐
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
All integers are implemented as “long” integer objects of arbitrary size. On error, most PyLong_As* APIs return (return type)-1 which cannot be distinguished from a number. Use PyErr_Occurred() to disambiguate. ... Part of the Limited API (as an opaque struct). This subtype of PyObject represents a Python integer object.
🌐
Python Course
python-course.eu › material › course › html › text19.html
Slide 20
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.
Find elsewhere
🌐
Fangohr
fangohr.github.io › blog › performance-of-pythons-long-data-type.html
Performance of Python's long data type — Computational Science and Data Science
Python 2.x has two integer datatypes: the int and the long. (In Python 3.x, the distinction disappears.) The int data type corresponds to the 'normal' integer data type that the CPU supports.
🌐
Medium
mike-vincent.medium.com › quarks-outlines-python-long-integers-3d41b1f0681f
Quark’s Outlines: Python Long Integers | by Mike Vincent | Medium
August 4, 2025 - 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.
🌐
Python
docs.python.org › 3 › builtins › stdtypes.html
Built-in Types — Python 3.14.7 documentation
The following sections describe the standard types that are built into the interpreter. The principal built-in types are numerics, sequences, mappings, classes, instances and exceptions. Some colle...
🌐
W3Schools
w3schools.com › python › python_numbers.asp
Python Numbers
Python Operators Arithmetic Operators Assignment Operators Ternary Operator Comparison Operators Logical Operators Identity Operators Membership Operators Bitwise Operators Operator Precedence Code Challenge Python Lists
🌐
Google Groups
groups.google.com › g › sage-devel › c › mb9tu_bw_yg
int vs long in cython
No, these routines are about the python types. They get used as `type(x) is int` and `type(x) is long`. They are used in a different namespace from `cdef int x` and `cdef long x` and cdef long long x` (well, the `x` is in the cython object namespace. The C-types don't make it into the cython object namespace.
🌐
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.
🌐
GitConnected
levelup.gitconnected.com › how-python-implements-super-long-integers-aabba0c988df
How python implements super long integers? | by Arpit | Medium
January 10, 2020 - An integer in Python is a C struct defined as following · PyObject_VAR_HEAD is a macro that expands into a PyVarObject that has the following structure ... This indicates that an integer, just like a tuple or a list, is variable in length and this is our first insight into how it could support gigantically long integers.
🌐
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.
🌐
Python Morsels
pythonmorsels.com › breaking-long-lines-code-python
Breaking up long lines of code in Python - Python Morsels
May 6, 2021 - If you have a very long line of code in Python and you'd like to break it up over multiple lines, you can continue on the next line as long as you're within braces or parentheses.
🌐
Python
docs.python.org › 3 › builtins › functions.html
Built-in Functions — Python 3.14.7 documentation
On most systems, the buffer will typically be 128 kilobytes long. “Interactive” text files (files for which isatty() returns True) use line buffering. Other text files use the policy described above for binary files. encoding is the name ...
🌐
Popular Science
popsci.com › environment › animals › wildlife › endangered species › longest snake ever measured is over 23.5 feet long
Longest snake ever measured is over 23.5 feet long | Popular Science
Nicknamed “Ibu Baron” (the Baroness), the giant female reticulated python (Malayopython reticulatus) discovered in late 2025 measures 23-feet-and-8-inches from head to tail—about the same length as a regulation soccer goal.
Published: March 6, 2026