From 55e10056e7c053c2f72d343a7e3215ab542c5020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= <sornjure@gmail.com> Date: Wed, 2 Oct 2019 21:49:22 +0200 Subject: [PATCH] Threading --- README.md | 2 +- index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2c06fc2..0c6ee21 100644 --- a/README.md +++ b/README.md @@ -2030,7 +2030,7 @@ with lock: ... ``` -### Thread Pool +### Thread Pool Executor ```python from concurrent.futures import ThreadPoolExecutor with ThreadPoolExecutor(max_workers=None) as executor: diff --git a/index.html b/index.html index dc59afe..7af620c 100644 --- a/index.html +++ b/index.html @@ -1786,7 +1786,7 @@ lock.release() ... </code></pre></div> -<div><h3 id="threadpool">Thread Pool</h3><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> concurrent.futures <span class="hljs-keyword">import</span> ThreadPoolExecutor +<div><h3 id="threadpoolexecutor">Thread Pool Executor</h3><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> concurrent.futures <span class="hljs-keyword">import</span> ThreadPoolExecutor <span class="hljs-keyword">with</span> ThreadPoolExecutor(max_workers=<span class="hljs-keyword">None</span>) <span class="hljs-keyword">as</span> executor: <iter> = executor.map(<span class="hljs-keyword">lambda</span> x: x + <span class="hljs-number">1</span>, range(<span class="hljs-number">3</span>)) <span class="hljs-comment"># (1, 2, 3)</span> <iter> = executor.map(<span class="hljs-keyword">lambda</span> x, y: x + y, <span class="hljs-string">'abc'</span>, <span class="hljs-string">'123'</span>) <span class="hljs-comment"># ('a1', 'b2', 'c3')</span>