sys.maxint in Python

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.

This code gives me the following result:

9223372036854775807
85070591730234615847396907784232501249

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”).

If you print this value, you are going to get the infinite number:

inf
inf
inf
inf
nan
inf
1.0

Adding, subtracting, and 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.