Python/C++ interface

Jay O'Connor joconnor at cybermesa.com
Thu Feb 1 22:18:03 CET 2001


All,

I was doing some testing with the Python->C++ interface and ran into
something odd.

The example shows calling a C function from python with 

	import spam
	spam.system ("ls -l")

and on the C++ side... the signature reads
	PyObject* spam_system(PyObject *self, PyObject * args) {
		...
	}

Now.  On the C++ side, args is considered, and parsed, as a Tuple. 
However, what I found was that a Tuple was not being passed, just a
String.  The only time a Tuple was passed was if there was more than one
argument.  The whole argument list would be converted to a Tuple, then.

Is this an error in the documentation?  Or has the passing method
changed between 1.5.x and 2.0 (I'm using 2.0) and the documentation is
just out of date?

Also,  is there a good way of printing the name of the type of a
PyObject?

Thanks
-- 
Jay O'Connor
joconnor at cybermesa.com
http://www.cybermesa.com/~joconnor

"God himself plays the bass strings first when He tunes the soul"



More information about the Python-list mailing list