Message275432
| Author | rhettinger |
|---|---|
| Recipients | alex0307, docs@python, rhettinger |
| Date | 2016-09-09.20:44:00 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1473453840.68.0.163151561345.issue27212@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
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']) |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2016-09-09 20:44:00 | rhettinger | set | recipients: + rhettinger, docs@python, alex0307 |
| 2016-09-09 20:44:00 | rhettinger | set | messageid: <1473453840.68.0.163151561345.issue27212@psf.upfronthosting.co.za> |
| 2016-09-09 20:44:00 | rhettinger | link | issue27212 messages |
| 2016-09-09 20:44:00 | rhettinger | create | |