On Tue, Apr 17, 2018 at 3:23 PM, Tim Peters
[Tim]
I'll channel that Guido would be happiest if this rule were followed:
Given an assignment statement using "=", the meaning is the same if "=" is replaced with ":=".
Thanks for channeling me. :=) I'd like Guido to chime in again, because I'm pretty sure he won't
accept what's currently on the table. There are two plausible ways to repair that:
1. Continue down the road of making assignment expressions "exactly like" assignment statements in their full generality.
2. Back off and limit assignment expressions to what appears to be the overwhelmingly most common case motivated by looking at real code (as opposed to constructing examples to illustrate pitfalls & obscurities):
identifier ":=" expression
I haven't had the time to follow this thread in detail; fortunately I don't have to because of Tim's excellent channeling. I am fine with this, it certainly seems the easiest to implement, with the fewest corner cases, and the easiest restriction to explain. (I was thinking there would be a use case for basic tuple unpacking, like seen a lot in for-loop, but the only examples I tried to come up with were pretty sub-optimal, so I don't worry about that any more.) -- --Guido van Rossum (python.org/~guido)