python use ProcessPoolExecutor easiliy?
<p>First I use <code>ProcessPoolExecutor</code> like this:</p>

<pre><code>def s(i):
    time.sleep(1)
    return i

futs = []
with ProcessPoolExecutor(max_workers=10) as executor:
    for i in range(WORKER_CNT):
        print executor.submit(s, i,).result()
</code></pre>

<p>but then I find this is not parallel, then I change to this:</p>

<pre><code>def s(i):
    time.sleep(1)
    return i

futs = []
with ProcessPoolExecutor(max_workers=10) as executor:
    for i in range(WORKER_CNT):
        futs.append(executor.submit(s, i,))

for f in futs:
    print f.result()
</code></pre>

<p>Then I begin to worry about the <code>WORKER_CNT</code> can be too big, and I need to wait to much time to see the last result, so I change to this:</p>

<pre><code>def s(i):
    time.sleep(1)
    return i

futs = []
with ProcessPoolExecutor(max_workers=10) as executor:
    for i in range(WORKER_CNT):
        futs.append(executor.submit(s, i,))
        if len(futs) == 10:
            for f in futs:
                print f.result()
            futs = []
</code></pre>

<p>this time, I can process <code>10</code> each time, <strong>I want to know can I do this easier?</strong></p>