mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
[3.12] gh-125289: Update sample code in asyncio-task.rst (GH-125292) (GH-125375)
gh-125289: Update sample code in asyncio-task.rst (GH-125292)
* Update sample code in asyncio-task.rst
This will change **coroutines** sample code in the **Awaitables** section and make the example clearer.
* Update Doc/library/asyncio-task.rst
Revert the added print
* Update Doc/library/asyncio-task.rst
---------
(cherry picked from commit fa52b82c91
)
Co-authored-by: Ghorban M. Tavakoly <58617996+galmyk@users.noreply.github.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
This commit is contained in:
parent
331fc017ce
commit
1d45fae26d
1 changed files with 1 additions and 1 deletions
|
@ -158,7 +158,7 @@ other coroutines::
|
||||||
# Nothing happens if we just call "nested()".
|
# Nothing happens if we just call "nested()".
|
||||||
# A coroutine object is created but not awaited,
|
# A coroutine object is created but not awaited,
|
||||||
# so it *won't run at all*.
|
# so it *won't run at all*.
|
||||||
nested()
|
nested() # will raise a "RuntimeWarning".
|
||||||
|
|
||||||
# Let's do it differently now and await it:
|
# Let's do it differently now and await it:
|
||||||
print(await nested()) # will print "42".
|
print(await nested()) # will print "42".
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue