On Thu, Apr 16, 2020 at 05:02:03PM -0000, [email protected] wrote:
> @
>
> > Do any other languages already have this feature?
>
> JavaScript ES6 has similar feature:
>
> ```javascript
> x = 1
> y = 2
> do_something({ x, y })
> ```
That certainly makes your suggested syntax look comparatively nicer :-)
I don't know what `{}` does in Javascript, but it looks like it is a
set, or a list, or some other sequence or collection. It doesn't look
like a mapping, since a mapping requires the elements come in key+value
pairs. The syntax above doesn't look like the elements are pairs.
Rust has the same issue (thanks Brett for the link):
User {
email: email,
username: username,
active: true,
sign_in_count: 1,
}
defines a struct with fields email etc. With the field init shortcut we
get:
User {
email,
username,
active,
sign_in_count,
}
whioh again looks like a single entity `email` etc, not a pair (email
key, email value).
So I will grant you that a least your proposal looks like a pair:
param = <blank>
where the value of <blank> is implied. So better than the
Javascript/Rust syntax.
--
Steven
_______________________________________________
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/Q5NIQCHUUF4AWYKL2UTFD5YDH377WJZB/
Code of Conduct: http://python.org/psf/codeofconduct/