On 8 Oct 2019, at 20:07, Todd <toddrjen@gmail.com> wrote:



On Tue, Oct 8, 2019 at 1:30 PM Anders Hovmöller <boxed@killingar.net> wrote:


On 8 Oct 2019, at 19:19, Caleb Donovick <donovick@cs.stanford.edu> wrote:


Because

>>> dict(foo=:1)
  File "<string>", line 1
    dict(foo=:1)
             ^
SyntaxError: invalid syntax

I don't see how that's an argument, we are talking about a syntax extension.   Slice builder syntax is only every allowed in a subscript.  Edit my original grammar change proposal to:

```
subscriptlist: ... | kwargsubscript (','  kwargsubscript )* [',']
kwargsubscript: NAME '=' subscript
```    

Now slices are allowed in keyword arguments.

I wasn't making an argument, I was wondering what exactly we are even discussing. It seems like people are inventing new syntax willy nilly in this thread and I am getting very confused :)

/ Anders 


I thought we were talking about allowing __getitem__ to support keywords.  I assumed the keywords would use the same syntax as positional values, and converting colons to slice objects is part of that syntax.  So this isn't new syntax, it is just making the positional and keyword syntaxes the same.

I don't see it. Can you give examples of all the variations of slicing and their keyword equivalent so I understand what you mean? I'll write out the slicing variants and you can fill in how it would look with keyword arguments:

x[:]
x[a:]
x[-a:]
x[a:b]
x[-a:b]
x[a:-b]
x[-a:-b]
x[:b]
x[:-b]