Hello I am trying define values of a dictionary in parallel using multiprocessing. When the function f() is called outside "pool" the dictionary value is set correctly. In the pool call however it fails.
What am I doing wrong? Thanks.
from multiprocessing import Pool
hits={}
def f(x):
hits[x] = x #this will involve a complex operation
f('000')
print hits['000']
if __name__ == '__main__':
pool = Pool(processes=2)
inputs = ['a','b','c']
result = pool.map(f, inputs)
print hits['a']
hitsin the parent.