I want to create a pool over a function of several variables where one is held fixed. If I was using a basic map I would have something like:
def test_map(a,b):
return a+b
serial_map = map(lambda x: test_map(2,x), [1, 1, 3])
But this does not work for a pool map:
from multiprocessing import Pool
p = Pool(4)
p.map(lambda x: test_map(2,x), [1, 1, 3])
I'm aware this causes a pickling error. My point is that I would like a workaround if it is possible. I know for regular maps the idiomatic way of handling this issue is with lambdas, I would like to know the pool.map way of handling this problem.