Paul Rubin <http://[EMAIL PROTECTED]> writes:
>     def get_from_queue(queue):
>        try:
>           return queue.get(block=False)
>        except Queue.Empty:
>           return QUEUE_IS_EMPTY

Alternatively:

     def get_from_queue(queue):
        try:
           return (queue.get(block=False), True)
        except Queue.Empty:
           return (None, False)

This is maybe a nicer interface (no special sentinel value needed).
You'd use

     value, nonempty = get_from_queue(queue)
      
if nonempty is true then the item is valid.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to