Is there any reason Queue shouldn't have an iterator interface?
I.e. instead of

    while True:
       item = work_queue.get()
       if item is quit_sentinel:
           # put sentinel back so other readers can find it
           work_queue.put(quit_sentinel)  
           break
       process(item)

with accompanying hair on the other side to create and send a sentinel,
you'd just say:

     for item in work_queue:
        process(item)

You'd still need hair at the writing end to tell the readers when to
finish, either by directly inserting a sentinel or with 
"work_queue.done()" or something like that.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to