Hi,

Imagine that you have a PyObject pointer 'object'
pointing to a Python integer ... let's say 42.

How would do you attach the variable "answer" to
it so that the code

PyRun_SimpleString("print answer");

works as expected ?

My current solution is:

__main__ = PyImport_ImportModule("__main__");
PyObject_SetAttrString(__main__, "answer", object);

Anything better ?

SB

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to