Have appreciated that a plurality of brackets on the back function python

In general, only a parenthesis after the function. If there is a visible braces brackets, indicating that the first function returns a function that, if after that there are brackets, indicating that front also returns a function. And so on.

Such fun () ()

def fun():
    print("this is fun");
    def _fun():
        print("this is _fun");
    return _fun;

Your task is to write a higher order function for chaining together a list of unary functions. In other words, it should return a function that does a left fold on the given functions.
chained([a,b,c,d])(input)

Should yield the same result as

d(c(b(a(input))))

在学习过程中有什么不懂得可以加我的
python学习扣扣qun,784758214
群里有不错的学习视频教程、开发工具与电子书籍。
与你分享python企业当下人才需求及怎么从零基础学习好python,和学习什么内容

def fun81(functions):
    def f(x):
        for fun in functions:
            x = fun(x);
        return x;
    return f;
Published 62 original articles · won praise 3 · Views 1320

Guess you like

Origin blog.csdn.net/NNNJ9355/article/details/103931231