Expand tuple into argument list?

Mark Howson markh at angband.org
Fri Jul 16 08:09:18 EDT 1999


Steven Work wrote:
 
> I'm new to Python.  I want a dispatch function -- takes a function
> name and other arguments, calls the named function with the remaining
> arguments.  This works for limited length argument lists:
> 
> def dispatch(fnname, *rest):
>     fn = dispatch.func_globals[fnname]

How about:

      return( apply(fn, rest))

Mark




More information about the Python-list mailing list