On 2008-08-13 00:50:11 +0100, "Gabriel Genellina"
<[EMAIL PROTECTED]> said:
En Tue, 12 Aug 2008 19:48:54 -0300, Cromulent
<[EMAIL PROTECTED]> escribi�:
On 2008-08-12 05:37:53 +0100, "Gabriel Genellina"
<[EMAIL PROTECTED]> said:
<snip>
Yes, forget about PyArg_ParseTuple. It's intended to parse function
arguments. Use the appropiate convert function for each object type.
For integers, use PyInt_AsLong; for floats, PyFloat_AsDouble, and so
on. Something like this (untested):
// for a column containing float values:
Py_ssize_t nitems = PyList_Size(the_python_list_of_floats)
// ...allocate the C array...
for (Py_ssize_t i=0; i<nitems; i++) {
PyObject* item = PyList_GetItem(the_python_list_of_floats, i);
your_c_array_of_double[i] = PyFloat_AsDouble(item);
}
Fantastic! Thanks for your help :). You've got me on the right path now.
--
"I disapprove of what you say, but I'll defend to the death your right
to say it." - Voltaire
--
http://mail.python.org/mailman/listinfo/python-list