On Mon, 14 Aug 2006 17:10:13 +0200, zxo102 <[EMAIL PROTECTED]> wrote:

> Hi,
>    I am using Queue from python2.4. Here is what happen to me:
>
> import Queue
> b = Queue.Queue(0)
> b.put(9999)
> b.get()   # this is ok, it pops out 9999
> b.get()   # this one does not return anything and is hang on there
>
> Anybody knows what is going on with the second b.get()?

What did you expect? Since you've done only one put in the Queue, there's  
nothing left in it. Since queues are meant to communicate between threads  
- and also often to synchronize them -, the default behaviour for the get  
when the queue is empty is to wait for something to be put in it. If you  
want your second get to fail, use the get_nowait method.

HTH
-- 
python -c "print ''.join([chr(154 - ord(c)) for c in  
'U(17zX(%,5.zmz5(17l8(%,5.Z*(93-965$l7+-'])"
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to