Dictionaries from C

kellyk at my-deja.com kellyk at my-deja.com
Thu Oct 5 17:32:50 EDT 2000


I've been looking for an interface that works similar to Py_BuildValue
for dictionaries only in reverse.

for example:

 PyObject *r= Py_BuildValue("{s:i, s:s}", "blah", 1, "blah2", "asdf");

will build a dictionary but I can't seem to find an easy way to reverse
the operation. Something like:

 int i;
 char *s;
 MysteryFunction(r, "{s:i, s:s}", "blah", &i, "blah2", &s);

PyArg_ParseTuple is almost the thing but it appears not to
do dictionaries. (Also, does PyArg_ParseTuple work for only for
arguments to a function or all tuples?).

Thanks, Kelly


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list