Note: while the accepted answer achieves the result I wanted, and @ecatmur answer provides a more comprehensive option, I feel it's very important to emphasize that my use case is a bad idea in the first place. This is explained very well in @Jason Orendorff answer below.
Note: this question is not a duplicate of the question about sys.maxint
. It has nothing to do with sys.maxint
; even in python 2 where sys.maxint
is available, it does NOT represent largest integer (see the accepted answer).
I need to create an integer that's larger than any other integer, meaning an int
object which returns True
when compared to any other int
object using >
. Use case: library function expects an integer, and the only easy way to force a certain behavior is to pass a very large integer.
In python 2, I can use sys.maxint
(edit: I was wrong). In python 3, math.inf
is the closest equivalent, but I can't convert it to int
.