I have a simple example as so:
import numpy as np
func_dict1 = {0: np.sin, 1: np.cos, 2: np.tan}
out = map(func_dict1.get, np.array([0, 2, 0]))
Here I am picking out three functions by their dictionary keys. Now I want to pass unique arguments to each function like so:
[f(x) for f,x in zip(out, [3,1,2])]
which renders the output:
[0.1411200080598672, 1.557407724654902, 0.9092974268256817]
But how can I do this with map?
I thought this would work, but it does not:
map(out, [3,1,2])
Where am I going wrong? And is there any benefit to using map over list comprehension? My prior is that it is faster but I confess to not being an expert on the subject.