gamma approximation : what is module cmath and where is it located ?

Steven D'Aprano steven at
Thu Jul 30 06:10:36 EDT 2009

On Wed, 29 Jul 2009 21:34:07 -0700, Chris Rebert wrote:

> The difference is that it handles complex numbers, whereas the plain
> "math" module doesn't.
> I would guess the reason there are separate modules is for performance,
> so as to avoid having to dispatch on type at runtime. But this is only a
> guess.

My understanding is that it is to avoid people who don't care about 
complex numbers being confused when math.sqrt(-1) returns 1j instead of 
raising an error.


More information about the Python-list mailing list