I have been looking to parallize some tasks in python but did not find anything useful. Here is the pseudo code for which I want to use parallelization:
# Here I define a list for the results. This list has to contain the results in the SAME order.
result_list = []
# Loop over a list of elements. I need to keep that loop. I mean,. in the final code this loop must be still there for specific reasons. Also, the results need to be stored in the SAME order.
for item in some_list:
# Here I use a method to process the item of the list. The method "task" is the function I want to parrallize
result = task(item)
# Here I append the result to the result list. The results must be in the SAME order as the input data
result_list.append(result)
I want to parallelize the method task
which takes a single item, processes it, and returns some results. I want to collect those results in the same order as in the original list.
The results in the final list result_list
has to be in the same order as the items in the input list.