Skip to content

Commit b691c91

Browse files
committed
clarify doc: specify that it is the size of a buffer of tasks and not results
1 parent 40c0318 commit b691c91

File tree

5 files changed

+24
-17
lines changed

5 files changed

+24
-17
lines changed

Doc/library/concurrent.futures.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ Executor Objects
4444

4545
Similar to :func:`map(fn, *iterables) <map>` except:
4646

47-
* the *iterables* are collected immediately rather than lazily, unless a
48-
*buffersize* is specified: If the buffer is full, then the iteration
49-
over *iterables* is paused until a result is yielded from the buffer.
47+
* The *iterables* are collected immediately rather than lazily, unless a
48+
*buffersize* is specified to limit the number of submitted tasks whose
49+
results have not yet been yielded. If the buffer is full, iteration over
50+
the *iterables* pauses until a result is yielded from the buffer.
5051

5152
* *fn* is executed asynchronously and several calls to
5253
*fn* may be made concurrently.
@@ -70,10 +71,10 @@ Executor Objects
7071
*chunksize* has no effect.
7172

7273
.. versionchanged:: 3.5
73-
Added the *chunksize* argument.
74+
Added the *chunksize* parameter.
7475

7576
.. versionchanged:: next
76-
Added the *buffersize* argument.
77+
Added the *buffersize* parameter.
7778

7879
.. method:: shutdown(wait=True, *, cancel_futures=False)
7980

Doc/whatsnew/3.14.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,10 @@ concurrent.futures
326326
(Contributed by Gregory P. Smith in :gh:`84559`.)
327327

328328
* Add the optional ``buffersize`` parameter to
329-
:meth:`concurrent.futures.Executor.map` to specify the number
330-
of results that can be buffered before being yielded.
329+
:meth:`concurrent.futures.Executor.map` to limit the number of submitted
330+
tasks whose results have not yet been yielded. If the buffer is full,
331+
iteration over the *iterables* pauses until a result is yielded from the
332+
buffer.
331333
(Contributed by Enzo Bonnal and Josh Rosenberg in :gh:`74028`.)
332334

333335
ctypes

Lib/concurrent/futures/_base.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -586,10 +586,11 @@ def map(self, fn, *iterables, timeout=None, chunksize=1, buffersize=None):
586586
before being passed to a child process. This argument is only
587587
used by ProcessPoolExecutor; it is ignored by
588588
ThreadPoolExecutor.
589-
buffersize: The number of results that can be buffered before being
590-
yielded. When the buffer is full, iteration over the input
591-
iterables is paused until a result is yielded from the buffer.
592-
If None, buffering is unlimited.
589+
buffersize: The number of submitted tasks whose results have not
590+
yet been yielded. If the buffer is full, iteration over the
591+
iterables pauses until a result is yielded from the buffer.
592+
If None, all input elements are eagerly collected, and a task is
593+
submitted for each.
593594
594595
Returns:
595596
An iterator equivalent to: map(func, *iterables) but the calls may

Lib/concurrent/futures/process.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -816,10 +816,11 @@ def map(self, fn, *iterables, timeout=None, chunksize=1, buffersize=None):
816816
chunksize: If greater than one, the iterables will be chopped into
817817
chunks of size chunksize and submitted to the process pool.
818818
If set to one, the items in the list will be sent one at a time.
819-
buffersize: The number of result chunks that can be buffered before
820-
being yielded. When the buffer is full, iteration over the
821-
input iterables is paused until a result chunk is yielded from
822-
the buffer. If None, buffering is unlimited.
819+
buffersize: The number of submitted tasks whose results have not
820+
yet been yielded. If the buffer is full, iteration over the
821+
iterables pauses until a result is yielded from the buffer.
822+
If None, all input elements are eagerly collected, and a task is
823+
submitted for each.
823824
824825
Returns:
825826
An iterator equivalent to: map(func, *iterables) but the calls may
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
Add the optional ``buffersize`` parameter to :meth:`concurrent.futures.Executor.map`
2-
to specify the number of results that can be buffered before being yielded.
1+
Add the optional ``buffersize`` parameter to
2+
:meth:`concurrent.futures.Executor.map` to limit the number of submitted tasks
3+
whose results have not yet been yielded. If the buffer is full, iteration over
4+
the *iterables* pauses until a result is yielded from the buffer.

0 commit comments

Comments
 (0)