[Python-Dev] PEP 572: Assignment Expressions
Mike Miller
python-dev at mgmiller.net
Tue Apr 24 16:18:57 EDT 2018
On 2018-04-23 14:19, Barry Warsaw wrote:
> Me too. Plus we *already* have precedence for spelling name bindings in similar constructs, such as import statements, with statements, and exceptions. It seems like a natural and Pythonic approach to extend that same spelling to binding expressions rather than introducing new, weird, symbols.
We've survived for decades without this syntax, so don't think the need is so
great that we need to rush it. Let's not "jump the shark." :D
In my opinion, "EXPR as NAME" is the only version worthy enough for the
readability of Python. It reads like psuedo-code, as advocates have described
in the past, and already used frequently in a fuzzy, non-dogmatic manner.
The point about the potential of a bug in the "with" statement is worth serious
consideration however. I don't have a problem with it, but if deemed
intolerable there was an additional solution I read upthread, believe by Kirill
and Steve.
Merely that, since all current use cases are in the if/while/comprehension
statements, it might be a good idea to limit binding-expressions there to avoid
issues/overuse elsewhere.
Well, there are a number of mitigations to the "with" issue that could be
considered.
(Hoping that this is my last post on the subject.)
-Mike
More information about the Python-Dev
mailing list