Python Glossary Русский

Python 3.6+cmathterm

cmath.inf

constants

Positive infinity in the cmath module: float('inf'), the same value as math.inf.

Syntax

cmath.inf

This is a real infinity, a float, not a complex; there is a separate constant infj for an infinite imaginary part. Its value equals math.inf and float('inf'), and == comparisons with them work (unlike NaN).

Examples

import cmath
import math
print(cmath.inf, cmath.inf == math.inf)  # → inf True
print(cmath.isinf(complex(cmath.inf, 0)))  # → True

See also

Open in the full glossarydocs.python.orgReport an inaccuracy