dynamic call of a function

Graham Ashton graz at mindless.com
Fri Oct 19 05:25:44 EDT 2001


In article <3BCFE666.C8C6136C at c-s.fr>, "anthony harel"
<anthony.harel at c-s.fr> wrote:

> 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 :
> [snip]
> Is it possible to do sommething like that : ch = "foo"
> apply(ch, ( ))???

I would have thought that in combination with getattr(), apply() would do
the job for you.

--
Graham



More information about the Python-list mailing list