我知道什么是闭包,什么是 lambda 函数,但我想知道它们的名称是什么:
>>> def foo(a, b):
>>> return a + b
>>>
>>> bar = foo
>>> bar(1, 1)
>>> 2
我只想知道在变量中绑定(bind)一个函数的事实
最佳答案
这叫做 first-class functions.引用维基百科:
Specifically, this means the language supports passing functions as arguments to other functions, returning them as the values from other functions, and assigning them to variables or storing them in data structures. [emphasis is mine]
关于python - python中的那个名字是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18078990/