On 3/2/07, Jim Jewett firstname.lastname@example.org wrote:
On 3/1/07, Adam Olsen email@example.com wrote:
__iter__ shouldn't modify the container.
generators do not need to be reiterable.
lists are reiterable, but I wouldn't expect a socket (treated as a file) to be.
For a queue that is already sorted, the natural use case is to take the task and do it, explicitly adding it back to the end if need be. I would expect an operation that *didn't* remove things from the queue to have view in the name somewhere.
A priorityqueue seems far more like a list than a socket though. I'd be very surprised if __iter__ was destructive. If destructive is the only option I would prefer it be a explicit method. Especially since it's common modify and reiterate over a priority queue, which I believe never happens for files or sockets.