David Mertz wrote:
> [...] Many of the new syntax ideas COULD be done with an
> arcane function that only needs to be written once (but better than my 15
> minute versions). The fact that such magic functions are not in widespread
> use, to my mind, argues quite strongly against them actually
Thanks @ChrisAngelico! I will get to it. Once a first draft is ready I'll share
the github link in here.
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
@AndrewBarnert yes I should have thought it better that there is no need to use
`kwargs` forcibly. My bad. I am a little more convinced of this being a solid
candidate solution to the problem. Thanks for talking me through!
Rodrigo Martins de Oliveira
@ChrisAngelico @EricVSmith Thank you for be willing to sponsor the PEP. I think
it may be best to start writing it already, as I see it, the proposal wasn't a
clear no (nor a clear yes but if it was to be, probably someone else would
already have proposed something in these lines and we
@ChrisAngelico I do prefer the original proposal, though I do see the point of
it being harder for beginner to understand.
The mode-switch proposal though would not impede one to mix shorthand and
longhand forms. This should be valid syntax:
```python
return render_template("index.html", *,
I believe this is a different feature, non-exclusive to the one proposed here,
that would also make it possible not to re-declare keywords.
But implementing this change with the argument of making function calls less
repetitive or verbose when having redundant named keywords and variables
@StevenDAprano we are discussing alternative syntaxes to enhance readability
and in place of blank assignments `k=` we could possibly use a sole `*`
character as indicative that the following parameters are all to be passed as
keywords.
In this syntax, the keyword to which the parameter will
@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
You have a fair point @DominikVilsmeier though I still believe this can workout
there are other alternatives up for discussion such as using the `=` character.
You see: after a keyword parameter you cannot define other positional ones, so
the new syntax can assume all parameters following a
Thanks @AlexHall I believe your version is even better in readability.
___
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/
I'm really open to discuss how we can achieve this feature with clearer syntax
than the first proposed version. If any of you have more ideas please share :)
@EricVSmith I didn't thought it through about the syntax with the `*` character
but your case is well covered:
```
self.do_something(
@
> Do any other languages already have this feature?
JavaScript ES6 has similar feature:
```javascript
x = 1
y = 2
do_something({ x, y })
```
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to
@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
Thanks for pointing the previous discussion @ChristopherBarker Proposals are
similar but the scope here is limited to function calls which does prevent a
bunch of issues already pointed out in the previous discussion.
___
Python-ideas mailing list --
I'm opening this thread to discuss and collect feedback on a language change to
support keyword arguments to be self-assigned using variables names.
Proposal
Taking the syntax from [bpo-36817](https://bugs.python.org/issue36817) which
just [made it to Python
15 matches
Mail list logo