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 Matthew Malcomson
Recipients Matthew Malcomson
Date 2016-06-24.19:13:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1466795612.87.0.341578291618.issue27384@psf.upfronthosting.co.za>
In-reply-to
Content
While the itertools.islice(iterator, n, n) trick is useful as used in the consume recipe, I find the current behaviour if stop is less than start (e.g. itertools.islice(iterator, 3, 0) ) to be surprising.

It still consumes the first three elements of the iterator, in the same manner as when start and stop are equal.
This is what the documentation implies, but I don't know whether that coincidence is by accident or design.

I would expect an iterator that immediately raises StopIteration but doesn't consume anything, but whether that's what most people would expect or not is another matter.
This would match the python version of islice() in the documentation, though I realise that implementation already diverges from the actual one via Issue 27212 .
History
Date User Action Args
2016-06-24 19:13:32Matthew Malcomsonsetrecipients: + Matthew Malcomson
2016-06-24 19:13:32Matthew Malcomsonsetmessageid: <1466795612.87.0.341578291618.issue27384@psf.upfronthosting.co.za>
2016-06-24 19:13:32Matthew Malcomsonlinkissue27384 messages
2016-06-24 19:13:32Matthew Malcomsoncreate