[Python-ideas] More useful slices

Rob Cliffe rob.cliffe at btinternet.com
Mon Feb 2 13:10:32 CET 2015


On 02/02/2015 11:19, Todd wrote:
>
> On Mon, Feb 2, 2015 at 11:53 AM, Chris Angelico <rosuav at gmail.com 
> <mailto:rosuav at gmail.com>> wrote:
>
>     On Mon, Feb 2, 2015 at 9:26 PM, Todd <toddrjen at gmail.com
>     <mailto:toddrjen at gmail.com>> wrote:
>     > First, it wouldn't be a replacement.  The existing range syntax
>     would still
>     > exist.
>     >
>     > But the reason it is beneficial is the same reason we have [a,
>     b, c] for
>     > list, {a:1, b:2, c:3} for dicts, {a, b, c} for sets, and (a, b,
>     c) for
>     > tuples. 
>
Well, we have to have *some* syntax for literal lists, dicts etc.
But we already have range, so there is no compelling need to add new syntax.

Having said that, I would have a sneaking admiration for a really 
concise syntax.
Perhaps if we had "Python without colons", we could write
     for i in 1 : 10
     for i in 1 : 10 : 2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150202/8748c37a/attachment.html>


More information about the Python-ideas mailing list