extending with C

Jesper Olsen jolsen at mailme.dk
Wed Jan 9 07:53:53 EST 2002


I need to write a python extension in C, and the method interface should
be able to handle "arrays of float".

In the python code, the array could be represented as a tupel, a list or 
an array it is not really important.

The extension needs to be able to receive such arrays, and to return them
to python.

How to do this? The python documentation only documents how to do this 
for simpel types.

One way I can imagine is to use the "O" format string with PyArg_ParseTuple,
and get back a pointer to the python object, which could be manipulated
through the python C-Api.

Is there a better way of doing this? 
In java this kind of interface is well documented through the jarray types...

Cheers
Jesper



More information about the Python-list mailing list