From 896271ad576536a9ee0a99e18ce30ae59567f1e4 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Tue, 29 Dec 2020 11:43:59 -0800 Subject: [PATCH 1/2] bpo-42783: documentation for asyncio.sleep(0) --- Doc/library/asyncio-task.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst index 45e58437e0366d..ab96b480ddc91f 100644 --- a/Doc/library/asyncio-task.rst +++ b/Doc/library/asyncio-task.rst @@ -293,6 +293,10 @@ Sleeping ``sleep()`` always suspends the current task, allowing other tasks to run. + Setting the delay to 0 provides an optimized path to to allow other + tasks to run. This can be used by long-running functions to avoid + blocking the event loop for the full duration of the function call. + .. _asyncio_example_sleep: Example of coroutine displaying the current date every second From 45daa5d6b1f05843925c29a18e5caa9b365d7e95 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Wed, 30 Dec 2020 21:26:09 -0800 Subject: [PATCH 2/2] Update Doc/library/asyncio-task.rst Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> --- 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 ab96b480ddc91f..1ca1b4a06d7e88 100644 --- a/Doc/library/asyncio-task.rst +++ b/Doc/library/asyncio-task.rst @@ -293,7 +293,7 @@ Sleeping ``sleep()`` always suspends the current task, allowing other tasks to run. - Setting the delay to 0 provides an optimized path to to allow other + Setting the delay to 0 provides an optimized path to allow other tasks to run. This can be used by long-running functions to avoid blocking the event loop for the full duration of the function call.