So I'm trying to follow the example here: Python multiprocessing pool.map for multiple arguments
What if I have three arguments and I need the third fixed to a value, e.g. some thing like this but it doesn't work. Raise TypeError saying partial_merge() takes exactly 2 arguments but only 1 given.
import multiprocessing
from functools import partial
def merge_names(a, b, c):
return '{} & {} & {}'.format(a, b, c)
if __name__ == '__main__':
names = [('Brown', 'Wilson'), ('Bartlett', 'Rivera'), ('Molloy', 'Opie')]
pool = multiprocessing.Pool(processes=3)
results = pool.map(partial(merge_names, c='Hello'), names)
pool.close()
pool.join()
print(results)