/usr/share/doc/python3-docs/html/_sources/library
Edit: /usr/share/doc/python3-docs/html/_sources/library/concurrent.futures.rst.txt (16910B)
:mod:`concurrent.futures` --- Launching parallel tasks
======================================================
.. module:: concurrent.futures
:synopsis: Execute computations concurrently using threads or processes.
.. versionadded:: 3.2
**Source code:** :source:`Lib/concurrent/futures/thread.py`
and :source:`Lib/concurrent/futures/process.py`
--------------
The :mod:`concurrent.futures` module provides a high-level interface for
asynchronously executing callables.
The asynchronous execution can be performed with threads, using
:class:`ThreadPoolExecutor`, or separate processes, using
:class:`ProcessPoolExecutor`. Both implement the same interface, which is
defined by the abstract :class:`Executor` class.
Executor Objects
----------------
.. class:: Executor
An abstract class that provides methods to execute calls asynchronously. It
should not be used directly, but through its concrete subclasses.
.. method:: submit(fn, *args, **kwargs)
Schedules the callable, *fn*, to be executed as ``fn(*args **kwargs)``
and returns a :class:`Future` object representing the execution of the
callable. ::
with ThreadPoolExecutor(max_workers=1) as executor:
future = executor.submit(pow, 323, 1235)
print(future.result())
.. method:: map(func, *iterables, timeout=None, chunksize=1)
Similar to :func:`map(func, *iterables)