On Thursday, August 29, 2013 11:05:38 PM UTC+2, Chris Angelico wrote: > On Fri, Aug 30, 2013 at 6:50 AM, <fp2...@gmail.com> wrote: > > > My way is so obvious that it may not be that interesting... > > > > > > def func4(f1,f2,f3,f4): > > > def anon(x): > > > f1(f2(f3(f4(x)))) > > > return anon > > > > Or have it return the result of f1. And then, since it's an anonymous > > function that simply returns an expression, I'd write it as: > > > > def func4(f1,f2,f3,f4): > > return lambda x: f1(f2(f3(f4(x)))) > > > > Of course, that's still restricted to precisely four args. Extending > > this concept to a variable number of arguments is, uhh, left as an > > exercise to the reader. Which will probably end up going back to > > reduce(). :) > > > > ChrisA
Chris, call me a snob, but I resent using lambdas (aren't they usually considered odd/bad practice in python?) -- http://mail.python.org/mailman/listinfo/python-list