generators shared among threads

jess.austin at jess.austin at
Tue Mar 7 08:30:22 CET 2006

Thanks for the great advice, Alex.  Here is a subclass that seems to

from Queue import Queue
from itertools import count

class reentrantQueue(Queue):
    def _init(self, maxsize):
        self.maxsize = 0
        self.queue = []   # so we don't have to override put()
        self.counter = count()
    def _empty(self):
        return False
    def _get(self):
    def next(self):
        return self.get()
    def __iter__(self):
        return self

More information about the Python-list mailing list