Dynamic function calling
Olaf Meyer
olaf.meyer at nokia.com
Fri Sep 1 08:52:15 EDT 2000
I'm wondering if it is possible to call functions just by having access
to their name in a string value. Something similar to:
def test():
print "test function"
f = "test"
apply(f, ())
This does not work of course, because f does not have the right type.
Is there a way to get a function object from the name (string)?
Thanks,
Olaf
________________________________________________________________________
Olaf Meyer <_Q_/ _ ,_~o
Nokia Networks \\_/ / //\ /~~\_/~\ ,,, ___ _~o
Heltorfer Str. 1 ^ \_ \>> | | #=#==========# | ___ _-\_<,
40472 Duesseldorf \\ \__/~\_/ ```
(*)/'(*)
Tel.: 0211-94123737
More information about the Python-list
mailing list