[snip[ > You have itertools.consume which is close to what you want: > > consume(imap(func, iterable)) # 2.x > > consume(map(func, iterable)) # 3.x > > HTH
It does! Though in my case this is simpler: deque(imap(func, iterable), 0) since the recipe for consume just calls deque anyway when you want to eat up the rest of the iterable. It also solves the iterator-variable leakage problem and is only a wee bit slower than a conventional for-loop. > > -- > Arnaud > -- > http://mail.python.org/mailman/listinfo/python-list > -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list