python中的append的用法 ,appen(L[i] (x)),不是很明白,求指教
文档里面是这么说明的list.append(x)
Add an item to the end of the list. Equivalent to a[len(a):] = [x].
但是在自学的时候,看到这么个函数定义
def applyEachTo(L, x):
result = []
for i in range(len(L)):
result.append(L[i](x))
return result
中间的result.append(L[i](x))不是很明白。整个是这样的
程序代码:def applyEachTo(L, x):
result = []
for i in range(len(L)):
result.append(L[i](x))
return result
def square(a):
return a*a
def halve(a):
return a/2
def inc(a):
return a+1
a = applyEachTo([inc, square, halve, abs], -3)






