From da52b653a54ffcef9168ef9c6a853f74b17815de Mon Sep 17 00:00:00 2001 From: "Ghorban M. Tavakoly" <58617996+galmyk@users.noreply.github.com> Date: Fri, 11 Oct 2024 03:29:56 +0330 Subject: [PATCH 1/3] Update sample code in asyncio-task.rst This will change **coroutines** sample code in the **Awaitables** section and make the example clearer. --- Doc/library/asyncio-task.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst index 4716a3f9c8ac79..6ac3ae455638c7 100644 --- a/Doc/library/asyncio-task.rst +++ b/Doc/library/asyncio-task.rst @@ -152,16 +152,16 @@ other coroutines:: import asyncio async def nested(): - return 42 + print(42) async def main(): # Nothing happens if we just call "nested()". # A coroutine object is created but not awaited, # so it *won't run at all*. - nested() + nested() # will raise a "RuntimeWarning". # Let's do it differently now and await it: - print(await nested()) # will print "42". + await nested() # will print "42". asyncio.run(main()) From 5bbb942791a1e6c837ce8922190afc107f098a37 Mon Sep 17 00:00:00 2001 From: "Ghorban M. Tavakoly" <58617996+galmyk@users.noreply.github.com> Date: Sat, 12 Oct 2024 22:23:56 +0330 Subject: [PATCH 2/3] Update Doc/library/asyncio-task.rst Revert the added print Co-authored-by: Carol Willing --- Doc/library/asyncio-task.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst index 6ac3ae455638c7..0d814a278a042e 100644 --- a/Doc/library/asyncio-task.rst +++ b/Doc/library/asyncio-task.rst @@ -152,7 +152,7 @@ other coroutines:: import asyncio async def nested(): - print(42) + return 42 async def main(): # Nothing happens if we just call "nested()". From 7e3cd87beddaef99029e472ee8f7d4a598dfc9f0 Mon Sep 17 00:00:00 2001 From: "Ghorban M. Tavakoly" <58617996+galmyk@users.noreply.github.com> Date: Sat, 12 Oct 2024 22:24:49 +0330 Subject: [PATCH 3/3] Update Doc/library/asyncio-task.rst Co-authored-by: Carol Willing --- Doc/library/asyncio-task.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst index 0d814a278a042e..f27e858cf420f4 100644 --- a/Doc/library/asyncio-task.rst +++ b/Doc/library/asyncio-task.rst @@ -161,7 +161,7 @@ other coroutines:: nested() # will raise a "RuntimeWarning". # Let's do it differently now and await it: - await nested() # will print "42". + print(await nested()) # will print "42". asyncio.run(main())