4 ms·
Relevant to Python 3 as well: a lot of methods has updated to use iterators when they can making the lazy and much more efficient
by iddan 9y ago
Relevant to Python 3 as well: a lot of methods has updated to use iterators when they can making the lazy and much more efficient
- kevin_thibedeau 9y agoIterators on small lists aren't always more efficient.
- trop 9y agoHence the first lazy evaluation example becomes something like import itertools list(itertools.islice(itertools.count(),10)) Though perhaps there is a more elegant (if not more efficient) way to do this?