summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio
diff options
context:
space:
mode:
authorJakub Stasiak <jakub@stasiak.at>2020-11-02 11:36:38 (GMT)
committerGitHub <noreply@github.com>2020-11-02 11:36:38 (GMT)
commitad37c66adcd474e3d42a51c63ecb6a54ca2d23f2 (patch)
tree1df3edf77e79beed8f87955a4f4226ce1c950318 /Lib/asyncio
parent1341582e165841810e2fbf89e23be0e92b4a9fdd (diff)
downloadcpython-ad37c66adcd474e3d42a51c63ecb6a54ca2d23f2.zip
cpython-ad37c66adcd474e3d42a51c63ecb6a54ca2d23f2.tar.gz
cpython-ad37c66adcd474e3d42a51c63ecb6a54ca2d23f2.tar.bz2
[3.8] bpo-42230: Improve asyncio documentation regarding accepting sets vs iterables (GH-23073) (GH-23105)
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] https://github.com/python/typeshed/blob/620989bac572f30349b95590ebe81a73ce0fe862/stdlib/3/asyncio/tasks.pyiGH-L161 [3] https://github.com/python/typeshed/blob/620989bac572f30349b95590ebe81a73ce0fe862/stdlib/3/asyncio/tasks.pyiGH-L40. (cherry picked from commit 3d86d090dcbbdfdd3e5a5951cab30612d6131222) Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
Diffstat (limited to 'Lib/asyncio')
-rw-r--r--Lib/asyncio/tasks.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py
index 9ca9fa0..1fa76a1 100644
--- a/Lib/asyncio/tasks.py
+++ b/Lib/asyncio/tasks.py
@@ -394,7 +394,7 @@ ALL_COMPLETED = concurrent.futures.ALL_COMPLETED
async def wait(fs, *, loop=None, timeout=None, return_when=ALL_COMPLETED):
"""Wait for the Futures and coroutines given by fs to complete.
- The sequence futures must not be empty.
+ The fs iterable must not be empty.
Coroutines will be wrapped in Tasks.
@@ -580,7 +580,7 @@ def as_completed(fs, *, loop=None, timeout=None):
Note: The futures 'f' are not necessarily members of fs.
"""
if futures.isfuture(fs) or coroutines.iscoroutine(fs):
- raise TypeError(f"expect a list of futures, not {type(fs).__name__}")
+ raise TypeError(f"expect an iterable of futures, not {type(fs).__name__}")
from .queues import Queue # Import here to avoid circular import problem.
done = Queue(loop=loop)