Parallelize for loop in python
<p>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.</p>

<pre><code>def evaluation():
    scores = []
    for chromosome in population:
        scores.append(costly_function(chromosome))
</code></pre>

<p>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 program would run sequentially.</p>

<p>I'm using python 2.7</p>