mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
bpo-42230: Improve asyncio documentation regarding accepting sets vs iterables (GH-23073)
People call wait() and as_completed() with various non-set iterables, a list should be the most common but there are others as well[1]. Considering typeshed also documents wait()[2] and as_completed()[3] as accepting arbitrary iterables I think it's a good idea to document the status quo better. [1] https://github.com/aio-libs/aiokafka/pull/672 [2]620989bac5/stdlib/3/asyncio/tasks.pyiGH-L161
[3]620989bac5/stdlib/3/asyncio/tasks.pyiGH-L40
(cherry picked from commit3d86d090dc
) Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
This commit is contained in:
parent
27c72ba45a
commit
ff852aabf2
2 changed files with 6 additions and 6 deletions
|
@ -504,10 +504,10 @@ Waiting Primitives
|
|||
return_when=ALL_COMPLETED)
|
||||
|
||||
Run :ref:`awaitable objects <asyncio-awaitables>` in the *aws*
|
||||
set concurrently and block until the condition specified
|
||||
iterable concurrently and block until the condition specified
|
||||
by *return_when*.
|
||||
|
||||
The *aws* set must not be empty.
|
||||
The *aws* iterable must not be empty.
|
||||
|
||||
Returns two sets of Tasks/Futures: ``(done, pending)``.
|
||||
|
||||
|
@ -593,9 +593,9 @@ Waiting Primitives
|
|||
.. function:: as_completed(aws, \*, loop=None, timeout=None)
|
||||
|
||||
Run :ref:`awaitable objects <asyncio-awaitables>` in the *aws*
|
||||
set concurrently. Return an iterator of coroutines.
|
||||
iterable concurrently. Return an iterator of coroutines.
|
||||
Each coroutine returned can be awaited to get the earliest next
|
||||
result from the set of the remaining awaitables.
|
||||
result from the iterable of the remaining awaitables.
|
||||
|
||||
Raises :exc:`asyncio.TimeoutError` if the timeout occurs before
|
||||
all Futures are done.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue