Embedding Python in C++ application: Question #1

Mark Hammond MarkH at ActiveState.com
Tue Dec 4 03:53:42 CET 2001


Russell Turpin wrote:

> Is there something like this? Is there a better way of doing
> this than just iterating on Py_BuildValue()? Am I missing 
> something obvious? 


Py_BuildValue is a convenience function.

To return your own value, simply create a new Python tuple of list, and 
populate it manually.  Return this as the result from the function.

If you search a little, you should find a number of examples of this. 
Try, eg, the os.listdir() source.

Mark.




More information about the Python-list mailing list