Raymond Hettinger added the comment: The recipe should be modified to consume the initial values. Something like this:
start, stop, step = s.start or 0, s.stop or sys.maxsize, s.step or 1 for i in zip(range(0, start), it): pass The recipe needs to pass these tests: it = iter('abcdefghi') assert list(islice(it, 4, 4)) == [] assert list(it) == ['e', 'f', 'g', 'h', 'i'] assert(list(islice('ABCDEFG', 2)) == ['A', 'B']) assert(list(islice('ABCDEFG', 2, 4)) == ['C', 'D']) assert(list(islice('ABCDEFG', 2, None)) == ['C', 'D', 'E', 'F', 'G']) assert(list(islice('ABCDEFG', 0, None, 2)) == ['A', 'C', 'E', 'G']) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27212> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com