dynamic invoke

lukasz.f24 at gmail.com lukasz.f24 at gmail.com
Fri Oct 19 06:39:27 EDT 2007


Hello,

Is there any way (other then eval) to invoke a method by passing
method name in a string.
It's very simple in php:
$oFoo = new Foo();
$dynamiMethod = "bar";
$oFoo->$dynamiMethod();

Unfortunately I can't find a good solution to do the same thing in
python. Does it have some build-in function to do it?

Kind Regards,

Lukasz.




More information about the Python-list mailing list