The cmath.isinf() function returns a Boolean value (True or False) indicating if either the real or the imaginary part of the input complex number is infinite.

cmath.isinf(x)
x The value(real or complex) to be checked. If it is a real number, it is converted to a complex number before th operation

The function returns True if the real or imaginary part of x is infinite, otherwise False.

import cmath

print(cmath.isinf(100+ 2j))
print(cmath.isinf(10+ -20j))
print(cmath.isinf(cmath.inf))
print(cmath.isinf(complex('inf')))
print(cmath.isinf(complex('-inf')))
print(cmath.isinf(complex(float('inf')+3j)))