Pythonic function composition

Alan G Isaac aisaac at american.edu
Mon Oct 25 12:11:47 EDT 2004


"Peter Otten" <__peter__ at web.de> wrote in message
news:clj5nq$jl$02$1 at news.t-online.com...
> >>> g2 = reduce(lambda f, g: lambda x: f(g(x)), fns)


Cool.  That gets me there.  I think
def compose(fns) : return reduce(lambda f, g: lambda x: f(g(x)), fns)
does exactly what I want.

Thanks,
Alan Isaac






More information about the Python-list mailing list