@Steven D'Aprano see that it doesn't actually have to look like a pair, it 
doesn't need to be one at all. Just like in:

```python
def f(a):
    ...
f(x)
```

`x` is implicitly assigned with `a`, i.e. this is `x = a` under the hood and 
there is no need to think of a key-value pair `x: a`. The same would go for the 
discussed assignment of keyword args using the `*` separator syntax (which 
seems more appealing to the ones in this thread than the original proposal):

```python
def f(a, b):
    ...
f(*, b, a)
```

The `*` would indicate that the following parameters are all keyword 
parameters, where the order doesn't matter and, unless explicitly defined, each 
passed parameter will be assigned to the argument with same name. So, under the 
hood you get `a = a` and `b = b`. In this syntax one can choose whether or not 
to explicitly defined the value of a keyword, so these statements would be 
equivalent:

```python
f(positional, *, keyword0, keyword1=explicit, keyword2)
f(positional, keyword0=keyword0, keyword1=explicit, keyword2=keyword2)
```

I'm against subverting dictionary literals declaration to support implicit 
pairs for the sake of readability. If that was the way we're going to implement 
this feature than I make your point mine, something like this just looks like a 
weird set not a dict:

```python
kw = {
    ,
    x,
    y,
}
f(**kw)
```

In Javascript ES6 they don't have sets built like python so `{}` always refers 
to objects being constructed. It does indeed support implicit key: value pairs, 
so in ES6 `{ a: a, b: x, c: c }` is equivalent to `{ a, b: x, c }`. This is 
okay for Javascript users because they would not thought it as sets and the 
only obvious assumption to make is that parameters are being implicitly 
assigned to members. This is not the case in Python so I would refrain from 
changing dictionary literals syntax.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/S4EXST7E3UOEXSOXHQKE6I5HTBFMEIOE/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to