Muhammad Alkarouri wrote: > On 23 Jan, 13:46, Peter Otten <__pete...@web.de> wrote:
>> def consume_islice(n, items): >> next(islice(items, n, n), None) > I submitted the bug report before considering this alternative, which > is better. I may add this later in the day, but I have to wait a > little as it seems you are going to optimize/improve the function > almost out of existence:) One problem: the above function doesn't consume the entire iterator like the original example does for n=None. Passing sys.maxint instead is not pretty. Peter -- http://mail.python.org/mailman/listinfo/python-list