Slicing with negative strides
Terry Reedy
tjreedy at udel.edu
Tue Oct 29 06:21:15 EDT 2013
On 10/29/2013 4:53 AM, Duncan Booth wrote:
> 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.
The idea is that one would not have to reverse 2 and 15 to get a
non-empty sequence.
--
Terry Jan Reedy
More information about the Python-list
mailing list