Max int in python

There is no soft limit for integer values in Python 3 - plain int is unbounded and limited only by RAM memory size. So you can assume you can store any value and it will work.

What if I need python max int for algorithm implementation?

Some algorithms should assume having a maximum value as a starting point.

For example, finding the minimum algorithm might be implemented by assigning max int value at the beginning and subsequently comparing it to each array value.

For these purposes, you should use a special constant math.inf instead of finding max int python's value.

To use it you should import math module:

import math

And then you can play with comparing math.inf:

  • math.inf > 0 - returns True
  • 1 > math.inf - returns False

As you can see math.inf is greater than every integer in the world, so you can assume it is a "virtual max int"