From: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> Date: Tue, 18 May 2021 22:31:27 +0000 (+0800) Subject: [3.9] bpo-42783: Documentation for asyncio.sleep(0) (GH-24002) (GH-24153) X-Git-Tag: v3.9.6~85 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=632b4034ab517b5d7f302c94fd9dc5a28c85f049;p=thirdparty%2FPython%2Fcpython.git [3.9] bpo-42783: Documentation for asyncio.sleep(0) (GH-24002) (GH-24153) Co-Authored-By: Simon Willison --- diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst index 87133e4cab30..ca6e525e9359 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 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. + .. deprecated-removed:: 3.8 3.10 The *loop* parameter.