How to parallelize 2 loops in python
<p>I need to make each iteration in different thread (for each of these 2 loops). </p>

<pre><code>var = 5
a = -7
b = 7
for i in range(var):
    for j in range(a, b):
        print(i, "   ", j)
</code></pre>

<p>How can I make it?</p>

<p>UPD:</p>

<pre><code>var = 5
a = -7
b = 7
max = 0
for i in range(var):
    for j in range(a, b):
        print(i, "   ", j)
        if i+j&gt;max:
            max=i+j
print(max)
</code></pre>

<p>If you want true multi-threading (which the 'threading' library doesn't do!) use the 'multiprocessing' library. The <a href="https://docs.python.org/2/library/multiprocessing.html#introduction" rel="nofollow">introduction section in the docs</a> has a good example.</p>

python multithreading