3 ms·
Python has something similar, you can cancel() any async task and it will throw a CancelledError inside the ongoing operation. I'm not sure how it would solve
by Too 7y ago
Python has something similar, you can cancel() any async task and it will throw a CancelledError inside the ongoing operation.
I'm not sure how it would solve backpressure though, because canceling a task is normally done by the caller, while backpressure comes from the other direction of the call stack.
- the_mitsuhiko 7y agoCancel in Python and a cancellation token are very different concepts. Cancellations in Python are not passed through the same way and you can’t await a cancellation.