Function application optimization.

Jacek Generowicz jacek.generowicz at cern.ch
Fri Dec 12 10:47:50 CET 2003


Given

  fncs = [func1, func2, ..., funcN]
  args = [arg1,  arg2,  ..., argN]

How should one spell

  results = map(lambda f,a: f(a), fncs, args)

in order to get the result most quickly ?



Unfortunately "apply" takes a tuple of arguments, and there is no
"funcall"[*] in Python.


[*] def funcall(fn, *args):
        return fn(*args)





More information about the Python-list mailing list