Dominik Vilsmeier wrote:
> I'm not sure if this is doable from the compiler perspective, but what
> about allowing tuples after `**` unpacking:
>
>      requests.post(url, **(data, params))
>
>      # similar to
>      requests.post(url, data=data, params=params)

+1. I can see the practical utility of the feature, but was strongly against the
other syntax proposals so far. IMO, the above alternative does a great job of
using an existing feature, and I think it would be rather easy to explain how
it works.


On Thu, Apr 16, 2020 at 3:06 PM Dominik Vilsmeier
<dominik.vilsme...@gmx.de> wrote:
>
> I'm not sure if this is doable from the compiler perspective, but what
> about allowing tuples after `**` unpacking:
>
>      requests.post(url, **(data, params))
>
>      # similar to
>      requests.post(url, data=data, params=params)
>
> Probably some magic would need to happen in order to merge the names
> with their values, but the same is true for the `post(url, data=,
> params=)` syntax.
>
>
> On 16.04.20 18:57, oliveira.rodrig...@gmail.com wrote:
> > @StevenDAprano and this goes for @RhodriJames , thank you for sharing your 
> > point of view. Indeed the proposed syntax is obscure and would not be that 
> > readable for beginners.
> >
> > Couldn't we work around this so? The concept is still good for me just the 
> > syntax that is obscure, maybe something like this would work:
> >
> > ```python
> > # '*' character delimits that subsequent passed parameters will be passed
> > # as keyword arguments with the same name of the variables used
> > self.do_something(positional, *, keyword)
> > # this would be equivalent to:
> > self.do_something(positional, keyword=keyword)
> > ```
> > I believe this is readable even if you don't know Python: `positional` and 
> > `keyword` are being passed as parameters, the `*` character is mysterious 
> > at first but so it is in `def foo(a, *, b)` and it doesn't get into the way 
> > of basic readability.
> >
> > Rodrigo Martins de Oliveira
> > _______________________________________________
> > 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/N2ZY5NQ5T2OJRSUGZJOANEQOGEQIYYIK/
> > Code of Conduct: http://python.org/psf/codeofconduct/
> _______________________________________________
> 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/S44VDMZ4AFBSGIQEVWMKKWOW4P6WRVXY/
> Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________
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/ZJ5FROVGX7WM5OPNAWPSGSUSBDWW33L5/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to