pocketpy/python/itertools.py
2024-12-25 03:12:41 +08:00

13 lines
275 B
Python

class chain:
def __init__(self, *iterable):
self.iterable = iterable
@classmethod
def from_iterable(cls, iterable):
for it in iterable:
yield from it
def __iter__(self):
for it in self.iterable:
yield from it