Python isinf function


isinf(x) function checks whether x is positive or negative infinity. It's a method of math module. Python infinity is represented as float('inf').

>>> import math
>>> math.isinf(float('inf'))
True