Building a function call? (update)
Francois De Serres
fdeserres at gmx.net
Wed Jul 13 19:31:44 CEST 2005
Scott David Daniels wrote:
>Francois De Serres wrote:
>>Francois De Serres wrote:
>>>Having a string: "dothat"
>>>and a tuple: (x, y)
>>>1. What's the best way to build a function call like: dothat(x,y)?
>>>Assuming dothat is def'd in the same module,
>>>2. is: eval("dothat(x,y)", None, (('x', 100), ('y', 200)))
>>>the right way to have it executed?
>You do know that you could do something like:
> result = eval('dothat')(100, 200)
>That is, eval of the function name gives you a function.
>--Scott David Daniels
>Scott.Daniels at Acm.Org
No I did not know. And, that, is smart!
More information about the Python-list