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 twouters
Recipients theller, twouters
Date 2007-08-30.20:10:18
SpamBayes Score 0.046940528
Marked as misclassified No
Message-id <1188504618.74.0.85938481184.issue1617699@psf.upfronthosting.co.za>
In-reply-to
Content
Well, that's not quite how I implemented the slicing, and it's also not
how the existing simple-slicing was implemented: A negative start index
is taken to mean 0, and a stop index below the start index is taken to
mean 'the start index' (leading to an empty slice.)

However, it isn't too hard to do what I think you want done: a negative
index means indexing before the pointer, not from the end of the
pointer, and missing indices are only okay if they clearly mean '0'
('start' when step > 0, 'stop' when step < 0.)

So:
 P[5:10] would slice from P[5] up to but not including P[10],
 P[-5:5] would slice from P[-5] up to but not including P[5],
 P[:5] would slice from P[0] up to but not including P[5],
 P[5::-1] would slice from P[5] down to *and including* P[0]
but the following would all be errors:
 P[5:]
 P[:5:-1]
 P[:]
 P[::-1]

Does that sound like what you wanted?
History
Date User Action Args
2007-08-30 20:10:18twouterssetspambayes_score: 0.0469405 -> 0.046940528
recipients: + twouters, theller
2007-08-30 20:10:18twouterssetspambayes_score: 0.0469405 -> 0.0469405
messageid: <1188504618.74.0.85938481184.issue1617699@psf.upfronthosting.co.za>
2007-08-30 20:10:18twouterslinkissue1617699 messages
2007-08-30 20:10:18twouterscreate