[Python-ideas] More useful slices

Nick Coghlan ncoghlan at gmail.com
Mon Feb 2 11:03:23 CET 2015


On 2 Feb 2015 01:14, "Todd" <toddrjen at gmail.com> wrote:
>
> Although slices and ranges are used for different things and implemented
differently, conceptually they are similar: they define an integer sequence
with a start, stop, and step size.  For this reason I think that slices
could provide useful syntactic sugar for defining ranges without
sacrificing clarity.

Why is this beneficial? We'd be replacing an easily looked up builtin name
with relatively cryptic syntax.

There's also the fact that "slice" itself is a builtin, so it's entirely
unclear that standalone usage of the slice syntax (if it was ever permitted
at all) should produce a range object instead of a slice object.

Regards,
Nick.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150202/641fdd7c/attachment.html>


More information about the Python-ideas mailing list