运算符()是函数调用。
例如:
def foo():
print('Foo executed')
def bar():
# We return the foo FUNCTION itself, without calling it.
return foo
在上面的代码中,如果执行
foo()
,它会打印“Foo executed”。但如果你执行
bar()
,它会回来的
foo
,这就是函数。所以你可以执行
bar()()
,其中第一个()执行函数栏,返回foo,然后使用第二个()调用返回的foo函数。
编辑:当我输入它时,你删除了what is the bunch(),因为它们对你来说是新的。。。但我只是把它放在那里也许会有帮助。