]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-42783: Documentation for asyncio.sleep(0) (#24002)
authorSimon Willison <swillison@gmail.com>
Thu, 7 Jan 2021 02:03:18 +0000 (18:03 -0800)
committerGitHub <noreply@github.com>
Thu, 7 Jan 2021 02:03:18 +0000 (12:03 +1000)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Doc/library/asyncio-task.rst

index 45e58437e0366db8f6264465cf12bb93f1e56833..1ca1b4a06d7e8801c0b723d5fe947f2af8d92fc1 100644 (file)
@@ -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.
+
    .. _asyncio_example_sleep:
 
    Example of coroutine displaying the current date every second