Ron Adam wrote:
>
> 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...
>
>     Committed revision 41366.

>
> You could then do...
>
>     func, args = execfunc['key1']
>     func(**args)

Interesting that both Ron and Alex made the same mistake.  Hmmm, makes
me wonder if they are two people or not...

If args is a tuple, it should be:

  func(*args)

If you want the full generality and use keyword args:

  func(*args, **kwargs)

kwargs would be a dictionary with string keys.

E.g.,

  execfunc = {'key1':(func1, (1,), {'keyarg': 42})}

HTH,
n

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

Reply via email to