Moshe Zadka wrote: > No, instead of: > > > class concat: > > def __init__(self, *iterators): > self.iterators = list(iterators) > > def __iter__(self): return self > > def next(self): > while self.iterators: > try: > return self.iterators[0].next() > except StopIteration: > del self.iterators[0] > else: > raise StopIteration > > > for x in concat(iter1, iter2): > do_something(x) Or: from __future__ import generators def concat(*iterators): for i in iterators: for x in i: yield x for x in concat(iter1, iter2): do_something(x) Just
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4