extending with C

Chris Barker chrishbarker at attbi.com
Wed Jan 9 14:29:28 EST 2002


Alex Martelli wrote:

> Some would choose to use Numpy arrays instead.

Yup. I was about to suggest that.

> However, Numpy is a
> separate (and largish) package, while module array is part of any
> Python distribution, so, unless there's something else arrayish that
> you need to do, I don't think Numpy is "better" in this context.

Alex is right. If all you need to do is pass a 1-d "array" of floats to
a C extension, the standard array module would be just fine, and perhaps
easier than NumPy.

However, it is highly unlikely that you are doing enough with a large
enough array of floats that you need a C extension, and NOT doing
anything else that would benefit from NumPy. In fact, if you are writing
this C extension to get performance (rather than interface with existing
code), you may very well not need it you were to use NumPy. It's well
worth checking out.

http://sourceforge.net/projects/numpy

-Chris


-- 
Christopher Barker,
Ph.D.                                                           
ChrisHBarker at attbi.net                ---           ---           ---
                                     ---@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Oil Spill Modeling                ------   @    ------   @   ------   @
Water Resources Engineering       -------      ---------     --------    
Coastal and Fluvial Hydrodynamics --------------------------------------
------------------------------------------------------------------------



More information about the Python-list mailing list