Fixed integer sequence generators to be good iterators.
@@ -3,6 +3,10 @@ from threading import Lock
class AbstractIntegerSequenceGenerator(object):
+
+ def __iter__(self):
+ return self
+
@abstractmethod
def __next__(self):
"""
@@ -17,7 +21,6 @@ class SimpleIntegerSequenceGenerator(AbstractIntegerSequenceGenerator):
self.lock = Lock()
def __next__(self):
- while True:
self.lock.acquire()
i = self.i
self.i += 1
