10 Dec
2014
10 Dec
'14
10:42 p.m.
On Wed, Dec 10, 2014 at 4:05 AM, Oscar Benjamin
mailto:oscar.j.benjamin@gmail.com> wrote: class TakeError(Exception): pass
def take(iterator, n=None): if n is None: try: return next(iterator) except StopIteration: raise TakeError else: return tuple(take(iterator) for _ in range(n))
Won't that just shift the problem from leaked StopIterations to leaked TakeErrors? -- Greg