parallel: add __init__ for py3
Since python3 is using __init__ instead init
it is needed to add this method.
@@ -92,7 +92,7 @@ class parallel(object):
def __iter__(self):
return self
- def next(self):
+ def __next__(self):
if not self.any_spawned or self.iteration_stopped:
raise StopIteration()
result = self.results.get()
@@ -105,6 +105,8 @@ class parallel(object):
return result
+ next = __next__
+
def _finish(self, greenlet):
if greenlet.successful():
self.results.put(greenlet.value)
