Parallelize for loop in python
问题 I have a genetic algorithm which I would like to speed up. I'm thinking the easiest way to achieve this is by pythons multiprocessing module. After running cProfile on my GA, I found out that most of the computational time takes place in the evaluation function. def evaluation(): scores = [] for chromosome in population: scores.append(costly_function(chromosome)) How would I go about to parallelize this method? It is important that all the scores append in the same order as they would if the