dynamic invoke
Jarek Zgoda
jzgoda at o2.usun.pl
Fri Oct 19 06:45:06 EDT 2007
More information about the Python-list mailing list
Fri Oct 19 06:45:06 EDT 2007
- Previous message (by thread): dynamic invoke
- Next message (by thread): dynamic invoke
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
lukasz.f24 at gmail.com napisaĆ(a): > 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? foo = getattr(module_or_object, 'function_name') foo() -- Jarek Zgoda Skype: jzgoda | GTalk: zgoda at jabber.aster.pl | voice: +48228430101 "We read Knuth so you don't have to." (Tim Peters)
- Previous message (by thread): dynamic invoke
- Next message (by thread): dynamic invoke
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list