Hi guys,
I use 'Threadpool' processing quite a lot but only for 1 dimensional lists of data.I am now trying to implement the same structure but passing a 2D array through the Threadpool.map interface to a function. The problem I have is how to access the values of the array within the function for further use.
Have I got the format wrong?
Any ideas please?
thanks
I use 'Threadpool' processing quite a lot but only for 1 dimensional lists of data.I am now trying to implement the same structure but passing a 2D array through the Threadpool.map interface to a function. The problem I have is how to access the values of the array within the function for further use.
array = [] def func(array): print(array[0][0] + ' ' array[0][1]) do stuff here..... return results p = ThreadPool(5) results = p.map(func, array) p.join p.terminate()This is the typical data in 'array'
Output:34319 -6
34319 -6
130497 0
187004 -6
187368 0
187340 -1
189637 -6
16272 -4
19633 5
184336 -7
189091 -1
184357 -1
189528 -1
In a 1-dimensional case, the 'array' list simply iterates through the list as it passed to the function. This doesn't seem the case for a 2D array.Have I got the format wrong?
Any ideas please?
thanks