gh-108951: document how to terminate an asyncio.TaskGroup
by picnixz · Pull Request #123837 · python/cpython (original) (raw)
Maybe it's because I'm not an English native / asyncio expert, but I feel a slight difference with "terminate", "cancel", "stop" and "abort":
- Cancel is kind of generic and can be used to convene the intent of "stopping" whatever is going on. In other words, it can mean "stop", "terminate", "abort" even though it does not use the cancellation in the asyncio sense.
- Stop hints me that I could perhaps resume it later (though you could say it would have been a pause/resume). (A bit like SIGSTOP/SIGCONT).
- Abort hints me that it's something abrupt and "not good". Like "abort the mission" or SIGABRT. It's more for an unexpected event.
I will go for terminate because:
- it terminates/ends/cancels/finishes something,
- it can be thought as SIGTERM which, when emitted, can be caught for a graceful exit (which is the case here, we literally catch the exception), and
- it could be thought as the signal for reaching a "terminal" state where you wouldn't continue (in contrast to "stop").