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

Nick Coghlan ncoghlan at gmail.com
Wed Oct 30 22:52:27 CET 2013


On 31 Oct 2013 07:14, "Greg Ewing" <greg.ewing at canterbury.ac.nz> wrote:
>
> 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.

You can't have new syntax without defining the desired semantics for that
syntax first. Since slices are just objects, it doesn't make sense to argue
about syntactic details until the desired semantics are actually clear and
demonstrated in an object based proof-of-concept.

Cheers,
Nick.

>
> --
> Greg
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20131031/168b647f/attachment.html>


More information about the Python-ideas mailing list