dynamic call of a function

anthony harel anthony.harel at c-s.fr
Fri Oct 19 04:37:58 EDT 2001


Hi,

Is it possible to make dynamic call of a function whith python ?

I have got a string that contains the name of the function I
want to call but I don't want to do something like this :

if ch == "foo" :
    self.foo( )
elif ch == "bar"
    self.bar( )
....

Is it possible to do sommething like that :
ch = "foo"
apply(ch, ( ))???


Thanks

--
Anthony HAREL





More information about the Python-list mailing list