Replying to myself, with a simpler version:

Roel Schroeven wrote:
Alan G Isaac wrote:
def compose(list_of_functions): return reduce(lambda f, g: lambda x:
f(g(x)), list_of_functions)

def compose(list_of_functions): def compose2(f, g): def func(x): return f(g(x)) return func return reduce(compose2, list_of_functions)

def compose(lof): def func(x): for f in reversed(lof): x = f(x) return x return func

Still not sure what version is best though.

--
"Codito ergo sum"
Roel Schroeven
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to