use of Queue

Alexandru Mosoi brtzsnr at
Wed Aug 27 13:58:09 CEST 2008

On Aug 27, 2:54 pm, Jeff <jeffo... at> wrote:

> Queue raises an Empty exception when there are no items left in the
> queue.  Put the q.get() call in a try block and exit in the except
> block.
Wrong. What if producer takes a long time to produce an item?
will find the queue empty and exit instead of waiting.

> You can also use a condition variable to signal threads to terminate.
This is the solution I want to avoid because it duplicates Queue's
I prefer having a clean solution with nice design to hacking Queue

More information about the Python-list mailing list