Re:PEP 572: Python assignment expressions has been accepted
by amorousf00p on Tuesday July 03, 2018 @07:56PM
(#17454484)
Quibbles and bits.
Python is the only language where I write logic and then massage data structures and outputs + design 'cooler' ways to create these for an extra hour -- a week after it is in production.
Re:PEP 572: Python assignment expressions has been accepted
by gshulegaard on Tuesday July 03, 2018 @09:28PM
(#17454765)
I wasn't really considering the repeated genearation on `io` in the `while` example...so now I see a clear benefit to the syntax. I guess I would say I am now lukewarm about adding this additional operator. It makes at least one logical structure nicer...but I wouldn't have been heartbroken if it wasn't accepted though.
In the second example, you have an extra call to foo for every element of stuff. If foo(z) is expensive, you'd probably want to write this as
instead - which I personally don't mind, but it's arguably not as clear as having the in-line assignment expression.