On 12/01/2014 06:17 AM, C. Michael Pilato wrote:
> On Mon, Dec 1, 2014 at 2:24 AM, Alexey Neyman <stilor_at_att.net
> <mailto:stilor_at_att.net>> wrote:
> Hi all,
> Please review/comment.
> Just a quick question, as my bindings knowledge has grown somewhat
> stale: why do some of the wrapper functions use a format string with
> the tuple notation (e.g., "(O)") and others not (e.g., "Oss#O&")?
> I notice that the basic editor wrapping methods have the same
> disparity. I'm probably overlooking something obvious, but hey, it's
> Monday, so be gentle.
It is rather the opposite: the "Oss#O&" implicitly requests a tuple
packing by virtue of having more than one value to pack.
PyObject_CallMethod (and other similar functions) defer to the
Py_BuildValue for the description of the format string. The latter
states that by default, it only builds a tuple if there are two or more
arguments to be packed; for one argument, it returns just the object
specified by the format string and for zero arguments, it returns None.
I am not sure what it would mean to pass a non-tuple to a callable
Python object as an argument though; haven't tried it myself.
Received on 2014-12-01 18:04:47 CET