[Tutor] Converting from Python list or tuple to C array
Tue, 16 Nov 1999 18:05:59 -0500
I need to send a list (or possibly a tuple, I haven't
decided which will be easiest) from Python out to an
extension module. Here is an example of what one of the
python function calls look like:
myfunc('name', 2.0, 3, 4, mylist)
I know how to get the 1st four arguments into the extension
using something along the lines of:
PyArg_ParseTuple(args, "sfii", &str1, &float1, &int1, &int2);
But how do I get the list (or tuple)? And once I have it, how
do I turn the PyObject into a C array? Note: "mylist" may be a
list of lists of arbitrary length.
Thanks for any pointers,
"I don't want the world... I just want your half."
-- TMBG (Anna Ng)