The following codes showed I tried to map a function list and got a type error of "'list' object is not callable".
The L1 is of type 'map', so I used list function to convert it and it still returned an error.
Do you have any idea about this problem? Thanks!
import math
func_list=[math.sin, math.cos, math.exp]
result=lambda L: map(func_list, L)
L=[0,0,0]
L1=result(L)
for x in L1:
print(x)
the type of result is <class 'function'> the type of result is <class 'map'>
Traceback (most recent call last)
<ipython-input-22-17579bed9240> in <module>
6 print("the type of result is " + str(type(result)))
7 print("the type of result is " + str(type(L1)))
----> 8 for x in L1:
9 print(x)
TypeError: 'list' object is not callable
mapexpects a function as its first argument, but[math.sin, math.cos, math.exp]is not a function, it's a list. What are you expecting it to do?