[issue29701] Add close method to queue.Queue

2017-03-04 Thread Raymond Hettinger
Raymond Hettinger added the comment: Here's a link to the feature request for Ruby, https://bugs.ruby-lang.org/issues/10600 . It looks like the feature was implemented without examining any concrete use cases. A quick code search on Github did not reveal any cases where the feature was ever u

[issue29701] Add close method to queue.Queue

2017-03-04 Thread Davin Potts
Davin Potts added the comment: The example of AMQP is perhaps a stronger argument for why multiprocessing.Queue.close should (or does) exist, not as much a reason for queue.Queue. The strongest point, I think, is the argument that existing patterns are lacking. In the multiprocessing module,

[issue29701] Add close method to queue.Queue

2017-03-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: Another Note * The current Python multiprocessing module version of Queue has a close() method. It isn't clear that use cases there are also applicable to plain queue module queues for threads. https://docs.python.org/3/library/multiprocessi

[issue29701] Add close method to queue.Queue

2017-03-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: Notes: -- * Ruby has a Queue.close() method like the one being proposed here. There is also a ?closed() call for testing the status: https://ruby-doc.org/core-2.3.0/Queue.html * Java queues do not have a closing method: https://docs.oracle.com/javas

[issue29701] Add close method to queue.Queue

2017-03-02 Thread Raymond Hettinger
Raymond Hettinger added the comment: I'll mull this one over for a while and take a look at what other languages are doing. My first impression is the close() is the wrong word because in other contexts it means that a resource has been freed and that no more calls are allowed. In this co

[issue29701] Add close method to queue.Queue

2017-03-02 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: -> rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http

[issue29701] Add close method to queue.Queue

2017-03-02 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue29701] Add close method to queue.Queue

2017-03-02 Thread Mathias Fröjdman
New submission from Mathias Fröjdman: queue.Queue should have a close() method. The result of calling the method would be to raise a new exception - queue.Closed, for any subsequent calls to Queue.put, and after the queue is empty, also for Queue.get. Why: To allow producers (callers of Queue.