Yves wrote:
What is the best way to execute a function which name is stored in a variable ?

One standard way is a dict mapping names to function objects.

>>> numfuncs = {'int':int, 'float':float}
>>> f='int'
>>> numfuncs[f]('33')
33

Since attributes gets mapped to a dict, this is similar to previous answer.

tjr

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to