gamma approximation : what is module cmath and where is it located ?
Chris Rebert
clp2 at rebertia.com
Thu Jul 30 00:34:07 EDT 2009
On Wed, Jul 29, 2009 at 9:24 PM, <pdlemper at earthlink.net> wrote:
<snip>
> But I can't figure out where it gets "cmath". Searching the Python
> directory reveals no more than a test_cmath. The only cmath I can find
> is a header file in another directory turboc++\Borland\include\
>
> dir(cmath) reveals 23 functions overlapping the 37 functions of
> the math module.
>
> What is cmath, where did it come from and how does it differ from
> the standard math module ?
It's a module in the standard library:
http://docs.python.org/library/cmath.html
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.
Cheers,
Chris
--
http://blog.rebertia.com
More information about the Python-list
mailing list