[Numpy-discussion] question about the data entry in the __array_interface__

Chris Barker - NOAA Federal chris.barker@noaa....
Sun Apr 7 15:49:41 CDT 2013


On Sun, Apr 7, 2013 at 6:26 AM, Valentin Haenel <valentin@haenel.co> wrote:
> I am currently working with a C extension that wraps a C library.
>
> The library contains a function that takes, amongst others, a 'void *'
> as an argument. Now, I would like for that function to be able to read
> the 'data' buffer of a numpy array and thus need to pass address from
> Python down into the C-extension.

I can't help but put in a plug for Cython for this kind of thing:

www.cython.org

Cython comes woth build-in support for numpy arrays, so they have
figured all this out for you.

-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