How to map 2 arguments if the firs argument is list
which has to iterate and the second shoud stay the same in each function call?
Here is the example without map to show what I really mean:
x = "something"
pool = Pool(4)
for code in get_codes():
pool.apply_async(execute, args=(code,x))
pool.close()
pool.join()
Now the code using map
:
pool = Pool(4)
pool.map(execute, WHAT TO PUT HERE)?
pool.close()
pool.join()
Example:
def print_it(x,y):
print x,y
xs = [0,1,2,3,4,5,6]
pool = Pool(3)
pool.map(""" map print_it on xs and y as '0'""")
pool.close()
pool.join()
1,0
0,0
2,0
3,0
5,0
4,0
6,0