[C++-sig] looking up functions

Renato Araujo renatox at gmail.com
Thu Nov 13 17:27:17 CET 2008


you can use:

python::object callback = obj.attr["function_name"];

callback();




On Thu, Nov 13, 2008 at 11:40 AM, Alan Baljeu <alanbaljeu at yahoo.com> wrote:
> I'm reading the Python extension tutorial, and I cannot believe the embedding section.  It tells me the only way to call a python function is to callout to python to pass back a function object which I then save so I can call it when I need to.  This seems ridiculous.  Surely there is a way to obtain Python function objects without going through that!  Does somebody have a way to ask for a function by name?
>
> Also, perhaps somebody can explain if there is something about Python that makes this difficult, why such is not the default way of doing interop.
>
>  Alan Baljeu
>
>
>      __________________________________________________________________
> Reclaim your name @ymail.com or @rocketmail.com. Get your new email address now! Go to http://ca.promos.yahoo.com/jacko/
> _______________________________________________
> Cplusplus-sig mailing list
> Cplusplus-sig at python.org
> http://mail.python.org/mailman/listinfo/cplusplus-sig
>



-- 
BR
Renato Araujo Oliveira Filho


More information about the Cplusplus-sig mailing list