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

Chris Rebert clp2 at rebertia.com
Thu Jul 30 06:20:41 EDT 2009


On Thu, Jul 30, 2009 at 3:10 AM, Steven
D'Aprano<steven at remove.this.cybersource.com.au> wrote:
> 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.

That seems a better and more plausible rationale than my guess. Kudos.

- Chris
-- 
http://blog.rebertia.com



More information about the Python-list mailing list