Queue.get_nowait() raises Empty when it's not...

Mark Hammond mhammond at skippinet.com.au
Wed Oct 27 07:52:03 EDT 1999


Stephen J. Turner <sjturner at ix.netcom.com> wrote:
> Of course, the documentation for the Queue module says as
> much, stating
> that Empty is "raised when non-blocking get() (or get_nowait()) is
> called on a Queue object which is empty *or locked*
> [emphasis mine]."

Eeek - this is definately bad.  Fredrik's suggestion would seem to
work, but it is still nasty.  I can see how this would be a real
"gotchya" - Empty should definately mean emtpy!  How expensive would
it be in practice to make it so?  Lacking the time to re-check the
implementation, I can't see how it could be too bad to guarantee this!

Mark.





More information about the Python-list mailing list