Embedding: how to extend a C++ instance by Python methods

Gerhard Häring gerhard.haering at gmx.de
Thu Jul 4 14:11:11 EDT 2002


Renzo Tomaselli wrote in comp.lang.python:
> Hi all,
> my current goal is to extend a C++ instance behavior by a Python
> method,

A C++ class that's exposed to Python, with one method delegating to a
Python method defined in a .py file?

> so that an explicit "execute(scriptName, args)" method on such
> instance will end up into running a Python method defined by
> scriptName.

Which execute() function is this? I found the rest of your post pretty
confusing.

If all you want is call a Python callable (function/method/...), you
can use PyObject_CallObject for this.

Else could you please try to rephrase your question a little?

Gerhard
-- 
mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
web:    http://www.cs.fhm.edu/~ifw00065/    OpenPGP public key id AD24C930
public key fingerprint: 3FCC 8700 3012 0A9E B0C9  3667 814B 9CAA AD24 C930
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))



More information about the Python-list mailing list