def build():
return lambda x:x*x
等同于:
def build():
def f(x):
return x*x
return f
引用
print(build()(5)) #等同于 f=build() print(f(5))
def build(x):
return lambda :x*x
等同于
def build(x):
def f():
return x*x
return f
引用
def build(x):
return lambda x:x*x
等同于
def build(x):
def f(x):
return x*x
return f
引用
print(build(5)(4)) #16
print(build('a')(4)) #16