Python simple ProcessPoolExecutor example wont work
<p>I'm trying out multithreading in Python 3, but I can't figure out why my example won't work. It should just print the numbers and as confirmation print the number again.
But it runs into many errors.</p>

<pre><code>from concurrent import futures

def print_me(num):
    print('Zahl: ' + str(num))
    return num


def say_bye(job):
    num = job.result()
    print(str(num) + ' is out!')


def test_multi():
    num_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
    with futures.ProcessPoolExecutor(max_workers=4) as executor:
        for num in num_list:
            job = executor.submit(print_me, num)
            job.add_done_callback(say_bye(job))

test_multi()
</code></pre>

<p>Theoretically, instead of:</p>

<pre><code>for num in num_list:
    job = executor.submit(print_me, num)
    job.add_done_callback(say_bye(job))`
</code></pre>

<p>I could use this, or?</p>

<pre><code>executor.map(print_me, num_list)
</code></pre>

<p>To get the code running i just need to add:</p>

<pre><code>**if __name__ == "__main__":**
    test_multi()
</code></pre>

python multithreading