I am wondering how to define inf
and -inf
as an int
in Python 2.7. I tried and it seems inf
and -inf
only work as a float
.
a = float('-inf') # works
b = float('inf') # works
c = int('-inf') # compile error, ValueError: invalid literal for int() with base 10: 'inf'
d = int('inf') # compile error, ValueError: invalid literal for int() with base 10: 'inf'