[EMAIL PROTECTED] wrote: > hi > i have a dictionary defined as > > execfunc = { 'key1' : func1 } > > to call func1, i simply have to write execfunc[key1] . > but if i have several arguments to func1 , like > > execfunc = { 'key1' : func1(**args) } > > how can i execute func1 with variable args? > using eval or exec? > > thanks
Eval or exec aren't needed. Normally you would just do... execfunc['key1'](**args) If your arguments are stored ahead of time with your function... execfunc = {'key1':(func1, args)} You could then do... func, args = execfunc['key1'] func(**args) Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list