bpo-40405: Fix asyncio.as_completed docs (GH-19753)

* Fix as_completed docs to correctly state the function return value.
* Also, improves the general wording of the as_completed documentation.

Co-Authored-By: Rémi Lapeyre <remi.lapeyre@henki.fr>
Co-Authored-By: Kyle Stanley <aeros167@gmail.com>
Co-Authored-By: Yury Selivanov <yury@edgedb.com>
This commit is contained in:
Bar Harel 2020-05-24 02:14:31 +03:00 committed by GitHub
parent 1cba1c9aba
commit 13206b52d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -585,9 +585,9 @@ Waiting Primitives
.. function:: as_completed(aws, \*, loop=None, timeout=None) .. function:: as_completed(aws, \*, loop=None, timeout=None)
Run :ref:`awaitable objects <asyncio-awaitables>` in the *aws* Run :ref:`awaitable objects <asyncio-awaitables>` in the *aws*
set concurrently. Return an iterator of :class:`Future` objects. set concurrently. Return an iterator of coroutines.
Each Future object returned represents the earliest result Each coroutine returned can be awaited to get the earliest next
from the set of the remaining awaitables. result from the set of the remaining awaitables.
Raises :exc:`asyncio.TimeoutError` if the timeout occurs before Raises :exc:`asyncio.TimeoutError` if the timeout occurs before
all Futures are done. all Futures are done.
@ -597,8 +597,8 @@ Waiting Primitives
Example:: Example::
for f in as_completed(aws): for coro in as_completed(aws):
earliest_result = await f earliest_result = await coro
# ... # ...