where to find the spec of format in PyObject_CallMethod
Huayang Xia
huayang.xia at gmail.com
Wed Jan 10 17:40:58 EST 2007
Thanks. I have mixed arguments.
I found the format spec @ http://docs.python.org/api/arg-parsing.html
On Jan 10, 5:31 pm, Carsten Haese <cars... at uniqsys.com> wrote:
> On Wed, 2007-01-10 at 14:05 -0800, Huayang Xia wrote:
> > I am trying to use PyObject_CallMethod. It needs a format string to
> > specify what are the followed arguments. Is it possible to use a
> > PyObject* as an argument?
>
> > Where can I find the spec for the format?
>
> > Thanks in advance.Seehttp://docs.python.org/api/object.html#l2h-247:
>
> Note in particular "The C arguments are described by a Py_BuildValue()
> format string that should produce a tuple" and "Note that if you only
> pass PyObject * args, PyObject_CallMethodObjArgs is a faster
> alternative."
>
> So, If all your arguments are PyObject pointers, use
> PyObject_CallMethodObjArgs instead. Otherwise, use PyObject_CallMethod
> and consult the documentation for Py_BuildValue on how to construct the
> format string.
>
> Hope this helps,
>
> Carsten.
More information about the Python-list
mailing list