dynamic invoke

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Fri Oct 19 11:17:11 EDT 2007


On Fri, 19 Oct 2007 10:29:12 -0400, Sushant wrote:

> Python will not allow string to be used a function pointer. It is type
> unsafe. Best way is to convert string into function pointers manually.
> 
> if dynamicMethod == 'bar':
>     method = oFoo->bar
> else:
>     method = oFoo->default
> method()


I don't know what language you're programming in there, but it isn't 
Python.

    method = oFoo->bar
                  ^
SyntaxError: invalid syntax



-- 
Steven.



More information about the Python-list mailing list