GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||
GeezerVison is showing github.com — gh-108951: document how to terminate an `asyncio.TaskGroup` by picnixz · Pull Request #123837 · python/cpython Conversation
|
|
Yeah, I feel the same because the example is a bit artificial. Your example with randomness was probably closer to what people expect in practice, namely tasks that complete in a non-deterministic order and maybe one of them would want to cancel the entire group, but this also means a non-deterministic output (which I don't really want to have in the docs...). As for playing the devil's advocate for this case, I don't see how we can "badly" use the helper, except if one explicitly changes the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
I knew it. When I was writing it I was like "hum... it's too long", so I wanted someone else's eyes, so thanks a lot for the comments Guido. I'll address them tomorrow |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
76942ed to
7c709b4
Compare
7c709b4 to
b4dc0bb
Compare
|
I kept the output because not everyone wants to run the code (sometimes, they just want to see the output). If you feel that neither the output nor the intermediate printing jobs are needed, please tell me. However, I think it's nice for the users to see a standalone working example. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Almost there! It looks nice and simple now.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
A last bike-shedding question: would it make sense to also rename CancelTaskGroup into StopTaskGroup? strictly speaking, the exception serves as a signal to cancel/stop the task group (in the English sense) but we neither use CancelledError nor .cancel().
We would still use cancel in the docstring but to highlight the non-use of CancelledError, having a visually different name could be helpful for users (but it could also be confusing because they are close to each other...).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I've added some suggestions.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Maybe it's because I'm not an English native / asyncio expert, but I feel a slight difference with "terminate", "cancel", "stop" and "abort":
I will go for terminate because:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@willingc I took the liberty of rewording a bit the introductory paragraph. I quite like the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks @picnixz. I appreciate your work on this. I think this is ready for merge, but I will give other folks a little time for reviewing.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Excellent! I will merge.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks @picnixz for the PR, and @gvanrossum for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…onGH-123837) We don't want to add another API, since the recipe is straightforward and rarely needed. The advantage is that we could backport this to the earliest Python version that has taskgroups (3.11, alas in security mode already, so we'll just do 3.12 and 3.13). (cherry picked from commit ef05801) Co-authored-by: Bénédikt Tran <[email protected]>
|
GH-123956 is a backport of this pull request to the 3.13 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…onGH-123837) We don't want to add another API, since the recipe is straightforward and rarely needed. The advantage is that we could backport this to the earliest Python version that has taskgroups (3.11, alas in security mode already, so we'll just do 3.12 and 3.13). (cherry picked from commit ef05801) Co-authored-by: Bénédikt Tran <[email protected]>
|
GH-123957 is a backport of this pull request to the 3.12 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
(Presumably the 3.13 backport will be held up by the upcoming release, unless the release manager deems doc PRs harmless. :-) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
asyncio.TaskGroupasyncio.TaskGroup
…123837) (#123956) gh-108951: Document how to terminate an asyncio.TaskGroup (GH-123837) We don't want to add another API, since the recipe is straightforward and rarely needed. The advantage is that we could backport this to the earliest Python version that has taskgroups (3.11, alas in security mode already, so we'll just do 3.12 and 3.13). (cherry picked from commit ef05801) Co-authored-by: Bénédikt Tran <[email protected]>
…123837) (#123957) gh-108951: Document how to terminate an asyncio.TaskGroup (GH-123837) We don't want to add another API, since the recipe is straightforward and rarely needed. The advantage is that we could backport this to the earliest Python version that has taskgroups (3.11, alas in security mode already, so we'll just do 3.12 and 3.13). (cherry picked from commit ef05801) Co-authored-by: Bénédikt Tran <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.