Hello developers.

I like the star expression.
It would be even better if we could extend the idea of PEP448 to
provide the following syntax at the time of assignment.

``` python
a, b, d, **_ = **{"a":0, " b":1, "c":2}, d=3

# Expressed as a function, it looks like this:
def func(a, b, d, **_):
  ...

func(**{"a":0, " b":1, "c":2}, d=3)
```
This is useful for splitting the dictionary


Ideally, it would be nice to be able to provide the same syntax when
calling the function.
I think this applies to the zen of python called "There should be
one-- and preferably only one --obvious way to do it.".

``` python
a, *args, b, **kwargs = 1, 2, *[3,4], **{"b", 4}, c=4

(
  a: str,
  *args,
  b: list = [],
  **kwargs
) = 1, 2, *[3,4], **{"b", 4}, c=4

func = lambda(
  a: str,
  *args,
  b: list = [],
  **kwargs
): print(a, b)
```

But it would be difficult because it would conflict with various
syntaxes(etc. PEP 3132).
We may have to declare it explicitly to avoid confusion.

``` python
# etc
a, b, *args, c = (1, 2, 3, 4, 5)
```

For example, prepare a keyword for unpack the positional arguments and
keyword arguments at the same time.

``` python
a, *args, b, **kwargs = ***(1, 2, *[3,4], **{"b", 4}, c=4)
```


I hope this is an idea to develop python.
Thanks.
_______________________________________________
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/Z3NSOCFXRBNSV24AGKWLAWA72TUJW3DK/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to