I have a list of functions: listFunc=[g1, g2, g3]. This list is generated with the code below:
def g(y):
def f(x):
return x+y;
return f;
listFunc=list(map(g, [1, 2, 3]));
Now, I have a list of arguments ListArg = [4, 5, 6];
How could I get a result list of [g1(4), g1(5), g1(6), g2(4), g2(5), g2(6), g3(4), g3(5), g3(6)]
using map
only?
I thought about using the following code:
map(lambda x:x(y), listFunc, ListArg)
But it only gives a result of [g1(4), g2(5), g3(6)]
.
Thanks,