On Apr 7, 11:40 pm, Paul Rubin <http://[EMAIL PROTECTED]> wrote: > Is there any reason Queue shouldn't have an iterator interface? > I.e. instead of > > while True: > item = work_queue.get() > if item is quit_sentinel: > # put sentinel back so other readers can find it > work_queue.put(quit_sentinel) > break > process(item)
It's almost equal to: for item in iter(work_queue.get, quit_sentinel): process(item) except that it doesn't keep the quit sentinel in the queue. But that's a personal preference, I usually put as many quit sentinels in a queue as many consumers. -- Leo -- http://mail.python.org/mailman/listinfo/python-list