-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
gh-125289: Update sample code in asyncio-task.rst #125292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This will change **coroutines** sample code in the **Awaitables** section and make the example clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this lgtm, but more broadly: i find this example weird in general that if i as a new user copy and paste it it just throws an error.
i think it would be nice to scour the documentation and "split" examples into working/non-working and denote them as such... @willingc thoughts?
|
@JacobCoffee I agree with splitting working and not working codes. But in this case, code works, just prints a warning: I'm not native english speaker, So I fear my wording in the following line's comment is not correct: ested() # will raise a "RuntimeWarning".It just prints the warning! If it is wrong, please propose a better comment. |
Hmm... there are a couple of concepts at work here: async/await, nesting coroutines, and example behavior I think the use of Where I do think it makes sense to improve this section of docs, but I want to make sure that we do it in a way that gets the point across clearly about nesting. |
|
@willingc , @JacobCoffee |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's revert the change in print and limit this PR to adding the runtime error comment.
Revert the added print Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @galmyk for the PR and @JacobCoffee for the initial review and discussion.
) * Update sample code in asyncio-task.rst This will change **coroutines** sample code in the **Awaitables** section and make the example clearer. * Update Doc/library/asyncio-task.rst Revert the added print Co-authored-by: Carol Willing <carolcode@willingconsulting.com> * Update Doc/library/asyncio-task.rst Co-authored-by: Carol Willing <carolcode@willingconsulting.com> --------- (cherry picked from commit fa52b82) Co-authored-by: Ghorban M. Tavakoly <58617996+galmyk@users.noreply.github.com> Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
) * Update sample code in asyncio-task.rst This will change **coroutines** sample code in the **Awaitables** section and make the example clearer. * Update Doc/library/asyncio-task.rst Revert the added print Co-authored-by: Carol Willing <carolcode@willingconsulting.com> * Update Doc/library/asyncio-task.rst Co-authored-by: Carol Willing <carolcode@willingconsulting.com> --------- (cherry picked from commit fa52b82) Co-authored-by: Ghorban M. Tavakoly <58617996+galmyk@users.noreply.github.com> Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
|
GH-125374 is a backport of this pull request to the 3.13 branch. |
|
GH-125375 is a backport of this pull request to the 3.12 branch. |
…H-125374) gh-125289: Update sample code in asyncio-task.rst (GH-125292) * Update sample code in asyncio-task.rst This will change **coroutines** sample code in the **Awaitables** section and make the example clearer. * Update Doc/library/asyncio-task.rst Revert the added print * Update Doc/library/asyncio-task.rst --------- (cherry picked from commit fa52b82) Co-authored-by: Ghorban M. Tavakoly <58617996+galmyk@users.noreply.github.com> Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
…H-125375) gh-125289: Update sample code in asyncio-task.rst (GH-125292) * Update sample code in asyncio-task.rst This will change **coroutines** sample code in the **Awaitables** section and make the example clearer. * Update Doc/library/asyncio-task.rst Revert the added print * Update Doc/library/asyncio-task.rst --------- (cherry picked from commit fa52b82) Co-authored-by: Ghorban M. Tavakoly <58617996+galmyk@users.noreply.github.com> Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
gh-125289: Update sample code in asyncio-task.rst
This will change coroutines sample code in the Awaitables section and make the example clearer.
📚 Documentation preview 📚: https://cpython-previews--125292.org.readthedocs.build/