Casting PyArrayObjects to C types
Kragen Sitaker
kragen at pobox.com
Tue May 28 18:25:09 EDT 2002
spam at fisher.forestry.uga.edu (Chris Fonnesbeck) writes:
> Most of the references to interacting python with C are with respect
> to extending, rather than embedding python. I am interested in the
> latter.
Section 5 of "Extending and Embedding the Python Interpreter" is
about embedding it.
> For example, how can I take a PyArrayObject, say a
> PyArray_DOUBLE and convert it to a double[] type in C? I have a C
> function that must call python code to get a Numeric Python array,
> change it to a standard C array, and return it. How would I do this.
There are sections in the Numerical Python docs about this; see
section 12, "Writing a C Extension to Numpy". Myself, I found it very
helpful to read the Numerical Python source code.
More information about the Python-list
mailing list