Consume an iterable

Paul Rubin no.email at nospam.invalid
Sun Jan 24 15:45:19 EST 2010


Raymond Hettinger <python at rcn.com> writes:
> This code consumes an iterator to exhaustion.
> It is short, sweet, and hard to beat.

I've always used sum(1 for x in iterator)  or some such.



More information about the Python-list mailing list