> It's not too hard to create your own dataflow class if you want one. > It can start with any arbitrary iterable, and then have your map and > filter methods just the same. Cool trick: you can even call your class > iter! :) > class iter: > _get_iterator = iter # snapshot the original > def __init__(self, basis): > self.basis = self._get_iterator(basis) > def map(self, func): > return type(self)(map(func, self.basis)) > # etc > def __iter__(self): return self > def __next__(self): return next(self.basis)
Cool tip, thanks! _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/7JY5QPPKYFZOKVWC3WOYUAN5VI7QA2TM/ Code of Conduct: http://python.org/psf/codeofconduct/