[Numpy-discussion] numpy.complex

Chris Barker chris.barker@noaa....
Fri Jul 20 15:24:49 CDT 2012


On Fri, Jul 20, 2012 at 1:17 PM, OC <oc-spam66@laposte.net> wrote:

>> numpy.complex is just a reference to the built in complex, so only works
>> on scalars:

> What is the use of storing the "complex()" built-in function in the
> numpy namespace, when it is already accessible from everywhere?

for consitancy with teh rest of the numpy types. When I create a numpy
array, I might do:

np.zeros( (3,4), dtype=np.float32 )

so for the numpy types that have a direct relationship with the python
types, we put the type in the numpy namespace as well. But, since in
numpy, you generally really want to control your types closely, I"d
tend to use:

np.zeros( (3,4), dtype=np.complex128 ) (or np.complex64) anyway.

-Chris



-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@noaa.gov


More information about the NumPy-Discussion mailing list