r/Python • u/bm371613 • Oct 13 '14
Python: rich iterator
I could not find a library to fit my needs, so I decided to write one.. (standard story)
Just in case I'm not good at searching: is there a library providing something like what I'm trying to do, so that I don't waste my time?
1
Upvotes
5
u/benhoyt PEP 471 Oct 13 '14
Please, Python != Lisp. :-) I fully agree with Guido here. Python has beautiful built-in tools to do filter and map: list comprehensions and generator expressions. For example:
Or, if you're dealing with large lists and want to keep them iterators, use generator expressions and the stdlib's itertools.islice: