Chris Jerdonek <chris.jerdo...@gmail.com> added the comment:

A second reason why Task.cancel() seems to be an incomplete replacement:

Task.set_exception() and Task.set_result() both give you a way to 
unconditionally end a task. With cancel() though, the docs say, "Task.cancel() 
does not guarantee that the Task will be cancelled." [1]

The reason you might want to unconditionally end a task is if e.g. you already 
called Task.cancel() and it is still running after waiting a certain amount of 
time.

[1]: https://docs.python.org/3/library/asyncio-task.html#asyncio.Task.cancel

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32363>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to