You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<Futr>=<Exec>.submit(<func>, <arg_1>, ...) #Starts a thread and returns its Future object.
2144
+
<iter>=<Exec>.map(<func>, <args_1>, ...) #Multithreaded and non-lazy map(). Keeps order.
2145
+
<Futr>=<Exec>.submit(<func>, <arg_1>, ...) #Creates a thread and returns its Future object.
2146
2146
<Exec>.shutdown(wait=True) # Blocks until all threads finish executing.
2147
2147
```
2148
2148
@@ -2153,7 +2153,7 @@ with <lock>: # Enters the block by calling acq
2153
2153
<iter>= as_completed(<coll_of_Futures>) # Each Future is yielded as it completes.
2154
2154
```
2155
2155
***Map() and as_completed() also accept 'timeout' argument that causes TimeoutError if result isn't available in 'timeout' seconds after next() is called.**
2156
-
***Exceptions that happen inside threads are raised when next() is called on map's iterator or when result() is called on a Future. It's exception() method returns exception or None.**
2156
+
***Exceptions that happen inside threads are raised when next() is called on map's iterator or when result() is called on a Future. Its exception() method returns exception or None.**
2157
2157
***An object with the same interface called ProcessPoolExecutor provides true parallelism by running a separate interpreter in each process. Arguments and results must be [pickable](#pickle).**
<lock>.release() <spanclass="hljs-comment"># Makes the lock available again.</span>
1753
1753
</code></pre></div>
1754
1754
1755
-
<div><h4id="or-1">Or:</h4><pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">with</span> <lock>: <spanclass="hljs-comment"># Enters the block by calling acquire(),</span>
1756
-
... <spanclass="hljs-comment"># and exits it with release(), even on error.</span>
1755
+
<div><h4id="or-1">Or:</h4><pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">with</span> <lock>: <spanclass="hljs-comment"># Enters the block by calling acquire() and</span>
1756
+
... <spanclass="hljs-comment"># exits it with release(), even on error.</span>
1757
1757
</code></pre></div>
1758
1758
1759
1759
<div><h3id="semaphoreeventbarrier">Semaphore, Event, Barrier</h3><pre><codeclass="python language-python hljs"><Semaphore> = Semaphore(value=<spanclass="hljs-number">1</span>) <spanclass="hljs-comment"># Lock that can be acquired by 'value' threads.</span>
<Futr> = <Exec>.submit(<func>, <arg_1>, ...) <spanclass="hljs-comment"># Creates a thread and returns its Future object.</span>
1774
1774
<Exec>.shutdown(wait=<spanclass="hljs-keyword">True</span>) <spanclass="hljs-comment"># Blocks until all threads finish executing.</span>
<li><strong>Map() and as_completed() also accept 'timeout' argument that causes TimeoutError if result isn't available in 'timeout' seconds after next() is called.</strong></li>
1784
-
<li><strong>Exceptions that happen inside threads are raised when next() is called on map's iterator or when result() is called on a Future. It's exception() method returns exception or None.</strong></li>
1784
+
<li><strong>Exceptions that happen inside threads are raised when next() is called on map's iterator or when result() is called on a Future. Its exception() method returns exception or None.</strong></li>
1785
1785
<li><strong>An object with the same interface called ProcessPoolExecutor provides true parallelism by running a separate interpreter in each process. Arguments and results must be <ahref="#pickle">pickable</a>.</strong></li>
1786
1786
</ul>
1787
1787
<div><h2id="operator"><ahref="#operator" name="operator">#</a>Operator</h2><p><strong>Module of functions that provide the functionality of operators.</strong></p><pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">import</span> operator <spanclass="hljs-keyword">as</span> op
0 commit comments