late bindings ???

Mike Heeter korora at sdf.lonestar.org
Mon Dec 2 11:26:31 EST 2002


Alfredo P. Ricafort wrote:

> func=['do_file','do_exit']
> apply(func[i],[args])

Try this:

apply(eval(func[i]),[args])

Or more simply:

eval(func[i])(args)

For example:

>>> def f():
>>>   print "Hello World"
>>>     
>>> l=["f"]
>>> eval(l[0])()
>>> Hello World


-- 



More information about the Python-list mailing list