using PyArg_ParseTuple with a list

j vickroy jvickroy at sec.noaa.gov
Fri Apr 21 15:53:20 EDT 2000


Hello all,

I wish to pass a Python list [] to a C extension module, but I am unsure
of the
proper format to specify in PyArg_ParseTuple (PyObject *args, char
*format, ...).

Should it be:

        (1) PyArg_ParseTuple (PyObject *args, "s#", ...) in which case
the list would be converted to a string with a length attribute
        (2) PyArg_ParseTuple (PyObject *args, "S", ...)
        (3) PyArg_ParseTuple (PyObject *args, "O&", ...) in which case I
would supply a converter function for the list

or something else?

Thanks in advance for your response.

- jv




More information about the Python-list mailing list