定义的函数括号里为什么有的有参数,有的没有参数
def calc_prod(lst):
def lazy_prod():
def f(x, y):
return x * y
return reduce(f, lst, 1)
return lazy_prod
f = calc_prod([1, 2, 3, 4])
print f()
def calc_prod(lst):
def lazy_prod():
def f(x, y):
return x * y
return reduce(f, lst, 1)
return lazy_prod
f = calc_prod([1, 2, 3, 4])
print f()
2020-02-12
举报