sys.maxint is the maximum value for the int variable in Python 2.
Python 3 doesn’t use this property because the int type in Python 3 has no limit. For Python 3, you can use sys.maxsize to check the maximum size lists, strings, dicts, and many other containers can have.
To check that there is no limit, you can use sys.maxsize and multiply by itself.
import sys a = sys.maxsize print(a) a *= sys.maxsize print(a)
This code gives me the following result:
The first number is the sys.maxsize number and the second one is sys.maxsize squared. As you can see, you can use really huge numbers in Python 3.
If you want to find the biggest number in Python 3, you can use float(“inf”).
a = float("inf") print(a - 1) print(a) print(a + 1) print(a * a) print(a / a) print(pow(a, 2)) print(pow(a, 0))
If you print this value, you are going to get the infinite number:
inf inf inf inf nan inf 1.0
Adding, subtracting, multiplying numbers by infinite give you infinity. If you try to divide infinity by infinity, it will give you Nan (not a number). You can also use the power function, and every number to the power of zero gives you 1. This is what we see in our example.