Consume an iterable

Peter Otten __peter__ at web.de
Sat Jan 23 08:32:37 EST 2010


Muhammad Alkarouri wrote:

> The next function performs much better. It is also much more direct
> for the purposes of consume and much more understandable (at least for
> me) as it doesn't require a specialized data structure which is
> subsequently not used as such.
> I am thus inclined to report it as a python documentation enhancement
> (bug) request. Any comments?

I would support that as a the deque(..., maxlen=0) trick is a bit too clever 
for my taste.

Peter

PS: Remember to include the bug fix for n=0 if you proceed.



More information about the Python-list mailing list