In the example code below, I\'d like to recover the return value of the function worker. How can I go about doing this? Where is this value stored?
worker
A simple solution:
import multiprocessing output=[] data = range(0,10) def f(x): return x**2 def handler(): p = multiprocessing.Pool(64) r=p.map(f, data) return r if __name__ == '__main__': output.append(handler()) print(output[0])
Output:
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]