diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2017-12-11 15:35:49 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-11 15:35:49 (GMT) |
commit | 8874342cf332c3aa3d845155cc4b41b00c2d9e9d (patch) | |
tree | 79b2b2a3413fde605670e995428e64144a509f77 /Doc/library/asyncio-task.rst | |
parent | abae67ebc2897ca37df067f322d19e19d1ef6d88 (diff) | |
download | cpython-8874342cf332c3aa3d845155cc4b41b00c2d9e9d.zip cpython-8874342cf332c3aa3d845155cc4b41b00c2d9e9d.tar.gz cpython-8874342cf332c3aa3d845155cc4b41b00c2d9e9d.tar.bz2 |
bpo-32258: Replace 'yield from' to 'await' in asyncio docs (#4779)
* Replace 'yield from' to 'await' in asyncio docs
* Fix docstrings
Diffstat (limited to 'Doc/library/asyncio-task.rst')
-rw-r--r-- | Doc/library/asyncio-task.rst | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst index 3656f79..a8a0a8e 100644 --- a/Doc/library/asyncio-task.rst +++ b/Doc/library/asyncio-task.rst @@ -515,7 +515,7 @@ Task functions Example:: for f in as_completed(fs): - result = yield from f # The 'yield from' may raise + result = await f # The 'await' may raise # Use result .. note:: @@ -630,11 +630,11 @@ Task functions The statement:: - res = yield from shield(something()) + res = await shield(something()) is exactly equivalent to the statement:: - res = yield from something() + res = await something() *except* that if the coroutine containing it is cancelled, the task running in ``something()`` is not cancelled. From the point of view of @@ -647,7 +647,7 @@ Task functions combine ``shield()`` with a try/except clause, as follows:: try: - res = yield from shield(something()) + res = await shield(something()) except CancelledError: res = None @@ -690,7 +690,7 @@ Task functions Usage:: - done, pending = yield from asyncio.wait(fs) + done, pending = await asyncio.wait(fs) .. note:: @@ -714,7 +714,7 @@ Task functions This function is a :ref:`coroutine <coroutine>`, usage:: - result = yield from asyncio.wait_for(fut, 60.0) + result = await asyncio.wait_for(fut, 60.0) .. versionchanged:: 3.4.3 If the wait is cancelled, the future *fut* is now also cancelled. |