This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author joncle
Recipients docs@python, joncle
Date 2010-09-24.22:15:41
SpamBayes Score 6.229975e-05
Marked as misclassified No
Message-id <1285366544.01.0.313980902629.issue9944@psf.upfronthosting.co.za>
In-reply-to
Content
Very low priority.

def consume(iterator, n):
    "Advance the iterator n-steps ahead. If n is none, consume entirely."
    # Use functions that consume iterators at C speed.
    if n is None:
        # feed the entire iterator into a zero-length deque
        collections.deque(iterator, maxlen=0)
    else:
        # advance to the emtpy slice starting at position n
        next(islice(iterator, n, n), None)

Hardly a show stoppper, and not me worth submitting a patch, but "emtpy" should be "empty". Just thought I'd make note of it before I forgot.
History
Date User Action Args
2010-09-24 22:15:44jonclesetrecipients: + joncle, docs@python
2010-09-24 22:15:44jonclesetmessageid: <1285366544.01.0.313980902629.issue9944@psf.upfronthosting.co.za>
2010-09-24 22:15:42jonclelinkissue9944 messages
2010-09-24 22:15:41jonclecreate