Is there any difference between the infinities returned by the math module and cmath module?
Does the complex infinity have an imaginary component of 0?
Any difference?
No, there is no difference. According to the docs, both math.inf and cmath.inf are equivalent to float('inf'), or floating-point infinity.
If you want a truly complex infinity that has a real component of infinity and an imaginary component of 0, you have to build it yourself: complex(math.inf, 0)
There is, however, cmath.infj, if you want 0 as a real value and infinity as the imaginary component.
Constructing imaginary infinity
As others have pointed out math.inf + 0j is a bit faster than complex(math.inf, 0). We're talking on the order of nanoseconds though.
Is there a difference between math.inf and cmath.inf in Python?