On 21Oct2018 21:19, Vladimir Filipović <hemf...@gmail.com> wrote:
On Sun, Oct 21, 2018 at 8:45 PM MRAB <pyt...@mrabarnett.plus.com> wrote:
FTR, this has been discussed before:
[Python-ideas] `__iter__` for queues?
https://mail.python.org/pipermail/python-ideas/2010-January/006711.html

Thank you!

Hmm, yes. My post there is this one:

 https://mail.python.org/pipermail/python-ideas/2010-January/006716.html

I want to point out that in my code the single consumer of a Queue is incredibly common, so common that I can't off the top of my head think of _any_ uses of Queue directly: I _always_ make an IterableQueue and simply have the consumer iterate over the iterable queue.

This is _exactly_ like Vladimir's proposal to my mind: my IterableQueue is iterable, and has a .close method just like his (prevent further puts and indicates end of stream) mediated with a sentinel internally. Arbitrary number of putters, _usually_ only one getter but of course there's no need for that.

So to my mind his proposal is very simple and sensible, and matches almost universally my own use of Queues.

Cheers,
Cameron Simpson <c...@cskk.id.au>
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to