PyArg_ParseTuple for parsing list and dictionary arguments

Pau Freixes pfreixes at gmail.com
Mon Sep 15 05:58:48 EDT 2008


Hi to all,

What's the best way for parse one list or dict argument with
PyArg_ParseTuple Function ?

If I have this python code :

import example

example.test("hellow", ["a", "b"], { "a" : 1 })

The c extension for implementation test function must be like this :

static PyObject * test( PyObject *self, PyObject *args)
{
   PyObject * dict, * list;
   char * string;

   PyArg_ParseTuple(args, "sOO", string, dict, list);
   ......
}

-- 
Pau Freixes
Linux GNU/User
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080915/97aad3e8/attachment.html>


More information about the Python-list mailing list