#import the cmath module
import cmath


The cmath module defines some useful constants, among them, is the inf constant. The inf constant  is a floating point value representing the mathematical notion of infinity.

In mathematics, infinity is a concept describing something that is limitless or endless. It is usually referred to as a number greater than any real or natural number.


The value returned is equivalent to float('inf').

import cmath

print(cmath.inf == float('inf'))
import cmath

print(sorted([1, 100, 50, 1000, 230, cmath.inf]))