[C++-sig] Re: [BPL] python::interpreter proposal

Joerg Sauer sauer at programmatic.de
Thu Jan 2 23:16:22 CET 2003


Hi,
up to know we have calling scripts, evaluations and files. 
What about calling python functions directly and pass it arguments.

Maybe I'm wrong, cause I'm new to all this, but I thought I could
build my extension modules, some in c++ using BPL and some as Python
code. In the Python modules I have declared some functions (in my case
script hooks to extend /change the default behaviour of my app).
Then I would like to call one of the functions and pass it their
params directly. As far as I see I would use one of
PyObject_CallObject()
PyObject_CallFunction()
PyObject_CallMethod()

As far as I can see using PyObject_CallObject() would have the
advantage to pass the parameters firectly. And with the to_python
conversions I could pass my apps c++ objects (wrapper classes).

This would have the advantage that the script (function) can
manipulate the data directly.

Using the proposed PyRun* calls has the disadvantage that I don't get
my objects to deal with only indirectly, or did I miss something?


Another thing is sync and async execution. For me it would be nice to
have the possibility to run a python script in both states. If it is
running async I would like to have 
a) a state function to get execution state (busy, finished)
b) registered callback to be triggered when execution is finished.

This could be done directly in the interpreter class or detaching a
new thread for async execution by myself. So what do you think, better
leaf async execution alone or include it as option in the interpreter?

Joerg








More information about the Cplusplus-sig mailing list