[Python-bugs-list] [ python-Bugs-730685 ] itertools.islice stop argument is not optional

SourceForge.net noreply@sourceforge.net
Thu, 01 May 2003 03:16:09 -0700


Bugs item #730685, was opened at 2003-05-01 11:15
Message generated for change (Settings changed) made by pmoore
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=730685&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Paul Moore (pmoore)
>Assigned to: Raymond Hettinger (rhettinger)
Summary: itertools.islice stop argument is not optional

Initial Comment:
The "stop" argument in the itertools islice function is not 
optional. This prevents useful options such as

    islice(it,10, None) # Everything from the 10th onward
    islice(it, 0, None, 2) # Every other item

I am using None here to mean that the stop argument is 
omitted - -1 might work as well. Keyword arguments 
may be better, but may be overkill.

For normal sequences, len(seq) can be used to give a 
stop value meaning "everything". This isn't possible in 
general for iterators.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=730685&group_id=5470