[Python-checkins] bpo-32306: Clarify c.f.Executor.map() documentation (GH-4947) (#4948)
Antoine Pitrou
webhook-mailer at python.org
Wed Dec 20 13:19:20 EST 2017
https://github.com/python/cpython/commit/4aa84e728565a15a82727b9b971126e355f47e9d
commit: 4aa84e728565a15a82727b9b971126e355f47e9d
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Antoine Pitrou <pitrou at free.fr>
date: 2017-12-20T19:19:18+01:00
summary:
bpo-32306: Clarify c.f.Executor.map() documentation (GH-4947) (#4948)
The built-in map() function collects function arguments lazily, but concurrent.futures.Executor.map() does so eagerly.
(cherry picked from commit a7a751dd7b08a5bb6cb399c1b2a6ca7b24aba51d)
files:
M Doc/library/concurrent.futures.rst
diff --git a/Doc/library/concurrent.futures.rst b/Doc/library/concurrent.futures.rst
index d85576b8bed..9794e735d42 100644
--- a/Doc/library/concurrent.futures.rst
+++ b/Doc/library/concurrent.futures.rst
@@ -40,21 +40,29 @@ Executor Objects
.. method:: map(func, *iterables, timeout=None, chunksize=1)
- Equivalent to :func:`map(func, *iterables) <map>` except *func* is executed
- asynchronously and several calls to *func* may be made concurrently. The
- returned iterator raises a :exc:`concurrent.futures.TimeoutError` if
- :meth:`~iterator.__next__` is called and the result isn't available
+ Similar to :func:`map(func, *iterables) <map>` except:
+
+ * the *iterables* are collected immediately rather than lazily;
+
+ * *func* is executed asynchronously and several calls to
+ *func* may be made concurrently.
+
+ The returned iterator raises a :exc:`concurrent.futures.TimeoutError`
+ if :meth:`~iterator.__next__` is called and the result isn't available
after *timeout* seconds from the original call to :meth:`Executor.map`.
*timeout* can be an int or a float. If *timeout* is not specified or
- ``None``, there is no limit to the wait time. If a call raises an
- exception, then that exception will be raised when its value is
- retrieved from the iterator. When using :class:`ProcessPoolExecutor`, this
- method chops *iterables* into a number of chunks which it submits to the
- pool as separate tasks. The (approximate) size of these chunks can be
- specified by setting *chunksize* to a positive integer. For very long
- iterables, using a large value for *chunksize* can significantly improve
- performance compared to the default size of 1. With :class:`ThreadPoolExecutor`,
- *chunksize* has no effect.
+ ``None``, there is no limit to the wait time.
+
+ If a *func* call raises an exception, then that exception will be
+ raised when its value is retrieved from the iterator.
+
+ When using :class:`ProcessPoolExecutor`, this method chops *iterables*
+ into a number of chunks which it submits to the pool as separate
+ tasks. The (approximate) size of these chunks can be specified by
+ setting *chunksize* to a positive integer. For very long iterables,
+ using a large value for *chunksize* can significantly improve
+ performance compared to the default size of 1. With
+ :class:`ThreadPoolExecutor`, *chunksize* has no effect.
.. versionchanged:: 3.5
Added the *chunksize* argument.
More information about the Python-checkins
mailing list