If we talk about Python 2, there were two data types for integers, i.e., int and long. Whereas in Python 3, there is only one integer data type that is int.
Python maxint or INT_MAX is used to denote that one highest value possessed by an integer in version 2 of Python.
We use python max int when we want to assign a larger value than any other integer value. These values can be assigned manually. But in Python 3, max int is removed as there is no limit for integers’ value.
In this article, we will learn how to use Python max int data type in version 3. There will be example code snippets along with the output for better understanding.
Table of Contents
Using sys Module
Maxint is supported in Python version 2 only because this constant has been removed in Python 3.
In Python version 3, a similar constant was introduced, sys.maxsize that returns the highest possible integer that is maximum size.
First, we have to import sys module; this module accesses the variables that the interpreter maintains. It carries out manipulations in the runtime environment.
import sys print( sys.maxsize )
This tutorial has cleared how to get the maximum integer value in Python 3. However, there is no concept of max integer size in version 3 of Python. I hope the example helped in understanding the concept.