This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: asyncio.sleep(0) idiom is not documented
Type: enhancement Stage: resolved
Components: asyncio, Documentation Versions: Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: asvetlov, docs@python, iritkatriel, kj, ncoghlan, simonw, yselivanov
Priority: normal Keywords: patch

Created on 2020-12-29 19:40 by simonw, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 24002 merged simonw, 2020-12-29 19:44
PR 24153 merged kj, 2021-01-07 14:48
Messages (4)
msg384025 - (view) Author: Simon Willison (simonw) * Date: 2020-12-29 19:40
asyncio.sleep(0) is the recommended idiom for co-operatively yielding control of the event loop to another task: https://github.com/python/asyncio/issues/284 and https://til.simonwillison.net/python/yielding-in-asyncio

This isn't currently explained in the documentation.
msg384550 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2021-01-07 02:03
New changeset 5c30145afb6053998e3518befff638d207047f00 by Simon Willison in branch 'master':
bpo-42783: Documentation for asyncio.sleep(0) (#24002)
https://github.com/python/cpython/commit/5c30145afb6053998e3518befff638d207047f00
msg384552 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2021-01-07 02:11
I merged the update to the 3.10 docs, but the automated backport to 3.9 to update the online docs failed.
msg393909 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-05-18 22:31
New changeset 632b4034ab517b5d7f302c94fd9dc5a28c85f049 by Ken Jin in branch '3.9':
[3.9] bpo-42783: Documentation for asyncio.sleep(0) (GH-24002) (GH-24153)
https://github.com/python/cpython/commit/632b4034ab517b5d7f302c94fd9dc5a28c85f049
History
Date User Action Args
2022-04-11 14:59:39adminsetgithub: 86949
2021-05-18 22:32:06iritkatrielsetstatus: open -> closed
stage: patch review -> resolved
2021-05-18 22:31:37iritkatrielsetnosy: + iritkatriel
messages: + msg393909
2021-01-07 14:48:50kjsetnosy: + kj

pull_requests: + pull_request22981
stage: backport needed -> patch review
2021-01-07 02:11:08ncoghlansetresolution: fixed
stage: patch review -> backport needed
messages: + msg384552
versions: + Python 3.9, Python 3.10
2021-01-07 02:03:27ncoghlansetnosy: + ncoghlan
messages: + msg384550
2020-12-29 19:44:24simonwsetkeywords: + patch
stage: patch review
pull_requests: + pull_request22845
2020-12-29 19:40:26simonwcreate