
Jan. 21, 2010
12:09 a.m.
Okay Raymond. Thanks for your patience. Ram. On Thu, Jan 21, 2010 at 12:48 AM, Raymond Hettinger < raymond.hettinger@gmail.com> wrote:
On Jan 20, 2010, at 12:28 PM, cool-RR wrote:
Thanks for the code Raymond. However, what I use is actually simpler:
def iterate(queue, block=False): '''Iterate over the items in the queue.''' while True: try: yield queue.get(block=block) except Queue.Empty: raise StopIteration
Then it sounds like the existing API is more than adequate for your needs. Dump the above fragment in your utils module and be done with it.
Raymond