[issue37334] Add a cancel method to asyncio Queues

Martin Teichmann report at bugs.python.org
Fri Nov 22 12:31:14 EST 2019


Martin Teichmann <martin.teichmann at gmail.com> added the comment:

Yes, in the one-producer-many-consumers situation on can indeed to the trick with the None. But this is just a clumsy hack, cancelling the tasks is IMHO more in line with asyncio.

In the many-producers-one-consumer scenario this does not work. The one dead consumer cannot feed back to the producers. Sure, there are still many hacks imaginable, but a closing or cancelling the queue is a very clear way of doing things.

As for the naming: I personally don't care, close() or cancel() are both fine with me.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37334>
_______________________________________


More information about the Python-bugs-list mailing list