I have a list of lists I want to fill with pool results. My code is currently incorrect due to the callback syntax:
finalData = [[],[],[]]
pool = mp.Pool()
pool.apply_async(findData, args=(x), callback= for i,val in enumerate(result): finalData[i].append(val) )
pool.close()
pool.join()
The results from findData are in the format:
results = [[1],[2],[3]]
Why can't I use the for loop inline as a callback to get these desired results:
finalData = [[1],[2],[3]]
I'm trying to avoid writing a callback function using finalData as a global variable.