Skip to content

Commit db03d99

Browse files
committed
add itertools.chain.from_iterable
1 parent e73bce5 commit db03d99

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

graalpython/lib-graalpython/itertools.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,15 @@ def __next__(self):
6262
return next(self._current)
6363
except (StopIteration, IndexError):
6464
self._idx += 1
65+
if self._idx >= self._len:
66+
raise StopIteration
6567
self._current = iter(self._iterables[self._idx])
6668
return self.__next__()
6769

70+
@classmethod
71+
def from_iterable(cls, arg):
72+
return cls(*iter(arg))
73+
6874

6975
class starmap():
7076
pass

0 commit comments

Comments
 (0)