On 4/16/2020 1:30 PM, Rhodri James wrote:
On 16/04/2020 17:57, [email protected] 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.
I beg to differ. I do find "def foo(a, *, b)" gets in the way of
readability.
And what would you do if you wanted to call:
self.do_something(positional, keyword=keyword, keyword1=somethingelse,
keyword2=keyword2)
?
Eric
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/GBFQMRFS6UMQ4HISA2UBILJHG6CU5HNZ/
Code of Conduct: http://python.org/psf/codeofconduct/