why the method get() of python Queue is hang on there?

Fredrik Lundh fredrik at pythonware.com
Mon Aug 14 11:25:30 EDT 2006


zxo102 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()?

the documentation has the answer:

     get( [block[, timeout]])

     Remove and return an item from the queue.  If optional args block
     is true and timeout is None (the default), block if necessary until
     an item is available. /.../

     http://docs.python.org/lib/QueueObjects.html

</F>




More information about the Python-list mailing list