[Python-ideas] PEP 572: Assignment Expressions (post #4)
Ethan Furman
ethan at stoneleaf.us
Wed Apr 11 14:38:23 EDT 2018
On 04/10/2018 10:32 PM, Chris Angelico wrote:
> Title: Assignment Expressions
Thank you, Chris, for doing all this!
---
Personally, I'm likely to only use this feature in `if` and `while` statements; if the syntax was easier to read inside
longer expressions then I might use this elsewhere -- but as has been noted by others, the on-the-spot assignment
creates asymmetries that further clutter the overall expression.
As Paul noted, I don't think parenthesis should be mandatory if the parser itself does not require them.
For myself, I prefer the EXPR as NAME variant for two reasons:
- puts the calculation first, which is what we are used to seeing in if/while statements; and
- matches already existing expression-level assignments (context managers, try/except blocks)
+0.5 from me.
--
~Ethan~
More information about the Python-ideas
mailing list