Building a function call?

Francois De Serres fdeserres at gmx.net
Wed Jul 13 08:54:13 EDT 2005


Roland Heiber wrote:

>Francois De Serres wrote:
>  
>
>>Hiho,
>>
>>Having a string: "dothat"
>>and a tuple: (x, y)
>>1. What's the best way to build a function call like: dothat(x,y)?
>>    
>>
>
>Not the best (not at all) but one way:
>  
>
Still pretty interesting, thx.

>def dothat(x,y):
>   print "Called with:", x, y
>
>c = (1,2)
>
>locals().get("dothat")(*c)
>
>----
>Called with: 1 2
>
>HtH, Roland
>  
>




More information about the Python-list mailing list