[capi-sig] expression as argument of a object

Hrvoje Niksic hniksic at xemacs.org
Thu Nov 22 20:23:41 CET 2012


"M.-A. Lemburg" <mal at egenix.com> writes:

>>     kwds = Py_BuildValue("sO", "comparator_type", comparator");
>
> Small typo:
>
> kwds = Py_BuildValue("{sO}", "comparator_type", comparator);
>
> The braces tell Py_BuildValue to create a dict.

Yup, sorry about that.

> For better readability, it also good to add the parens to
> the args format string:
>
> args = Py_BuildValue("(ss)", "keyspace", "CF");

I concur.  Likewise, dict can be expressed as "{s:O}", which reminds of
the dict building syntax in Python.


More information about the capi-sig mailing list