On Mon, Jun 24, 2019 at 2:44 PM Andrew Barnert via Python-ideas
<[email protected]> wrote:
> But dict displays, that could be confusing. Do you have to pass-value the
> key, or the value, or either of the two, or both consistently? If the key,
> does that short-circuit the value expression? So I think you’re right, that’s
> possibly worth banning even if you have to go out of your way to do so.
>
I think if this could be made to work for list displays and function
arguments, it wouldn't be too hard to settle the semantics for a dict.
My personal shed colour would be: omit the key and the value won't be
evaluated; omit either to suppress the result. But there are other
valid semantics, and it'd just be a matter of picking something sane.
The biggest problem with this proposal is the way that, being a
syntactic construct, it's going to be non-composable.
# Oops, syntax error
with (some_expr as q,
some_other_expr as w):
pass
ChrisA
_______________________________________________
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/C4767H7ZZZO766B3OPFNZXZLFTBFEXCT/
Code of Conduct: http://python.org/psf/codeofconduct/