[Python-ideas] Where did we go wrong with negative stride?

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Oct 30 22:11:31 CET 2013


Paul Moore wrote:
> I would definitely use
> 
>     b = a[::-1]
> 
> over
> 
>     b = a[Slice(None, None, None, reversed=True)]

Indeed, the whole reason for having slice syntax is that
it's very concise. One of the things I like most about
Python is that I get to write s[a:b] instead of something
like s.substr(a, b).

I would be very disappointed if I were forced to use
the above monstrosity in some cases.

-- 
Greg


More information about the Python-ideas mailing list