Slicing with negative strides

Duncan Booth duncan.booth at invalid.invalid
Tue Oct 29 04:53:08 EDT 2013


Steven D'Aprano <steve at pearwood.info> wrote:

> Does anyone here use slices (or range/xrange) with negative strides
> other than -1?
> 
> E.g. sequence[2:15:-3]

With any negative stride your example is just the empty sequence.

> 
> 
> If so, there is a discussion (long, long, looooooong discussion) on
> the python-ideas mailing list, debating whether or not to deprecate or
> change the behaviour of slicing with negative strides. So if you care
> about the current behaviour, now is the time to stand up and be
> counted. 
> 
> (Standing up *here* is fine, don't feel that you have to join yet
> another list.)
> 
For those of us that don't really want to join another mailing list, could 
you summarise what change is being proposed?


-- 
Duncan Booth http://kupuguy.blogspot.com



More information about the Python-list mailing list