8000 bpo-42783: Documentation for asyncio.sleep(0) (#24002) · python/cpython@5c30145 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5c30145

Browse files
bpo-42783: Documentation for asyncio.sleep(0) (#24002)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
1 parent deab1e5 commit 5c30145

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Doc/library/asyncio-task.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,10 @@ Sleeping
293293
``sleep()`` always suspends the current task, allowing other tasks
294294
to run.
295295

296+
Setting the delay to 0 provides an optimized path to allow other
297+
tasks to run. This can be used by long-running functions to avoid
298+
blocking the event loop for the full duration of the function call.
299+
296300
.. _asyncio_example_sleep:
297301

298302
Example of coroutine displaying the current date every second

0 commit comments

Comments
 (0)
0