[Python-Dev] PEP 572: Assignment Expressions (original) (raw)

Christoph Groth christoph at grothesque.org
Fri Apr 20 14:31:14 EDT 2018


Ethan Furman wrote:

On 04/20/2018 11:15 AM, Christoph Groth wrote: > Nick Coghlan wrote: > >> I also think that if "=" and ":=" both target the same kind of scope, >> there isn't enough new expressiveness introduced by the latter to >> justify the syntactic complexity of adding it. > > OK, but then how about introducing assignment expressions with the "=" > operator but requiring extra parens (similar to how modern C > compilers warn about assignment expressions without parens), e.g.

Using a single "=" for assignment expressions isn't going to happen. Period.

Huh, I didn't want to irritate anyone!

Guido wrote [1] on python-ideas:

I also think it's fair to at least reconsider adding inline assignment, with the "traditional" semantics (possibly with mandatory parentheses). This would be easier to learn and understand for people who are familiar with it from other languages (C++, Java, JavaScript).

I interpreted this in the way that he at least doesn't rule out "= with parens" completely. Perhaps he meant ":= with parens", but that would seem redundant.

[1] https://mail.python.org/pipermail/python-ideas/2018-March/049409.html



More information about the Python-Dev mailing list