How does a C API-function returns a list to python

torsten.maass at imms.de torsten.maass at imms.de
Sun Jan 12 21:08:50 CET 2003


Hi,

I want to write a communication-functions set for a special
hardware component for python using C API.

Does anybody know if and how it is possible to return a list 
to python from a read C-Array.

e.g.
c-function myfunction:
.....

double a[5]={1.0,2.0,3.0,4.0,5.0};
....
return Py_BuildValue("???",a)
....



python:
>>>  a=[0.0,0.0,0.0,0.0,0.0]
>>>  a=myfunction.command(some_args)
>>>  a
[1.0,2.0,3.0,4.0,5.0]
>>>




More information about the Python-list mailing list