Tim Chase writes:

> On 2013-08-28 05:52, AdamKal wrote:
> > From time to time I have to apply a series of functions to a value
> > in such a way:
> > 
> > func4(func3(func2(func1(myval))))
> > 
> > I was wondering if there is a function in standard library that
> > would take a list of functions and a initial value and do the above
> > like this:
> > 
> > func_im_looking_for([func1, func2, func3, func4], myval)
> 
> At least in Py2.x you can use reduce:
> 
>   reduce(lambda value, fn: fn(value), [list_of_functions], myval)

I notice now that I didn't notice, when I just sent the same solution,
that the function list was already backwards to its intended order of
application, so yes, this should work as wanted.

Sorry.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to