On Tue, Apr 24, 2018 at 11:07 AM, Chris Angelico <ros...@gmail.com> wrote: [..]
> x = 1 > if (x = 2): ... > > This, according to your proposal, raises SyntaxError - not because a > comparison was wanted and an assignment was made, but because the name > already had a value. And, even worse, this is NOT an error: Yes, because I'm trying to think about this from a pragmatic side of things. My question to myself: "what syntax could I use that would prevent me from making '=' vs '==' mistake when I code?" To me, the answer is that I usually want to compare local variables. When I compare to variables from outer scopes they *usually* are on the *right* side of '=='. > > x = 1 > def f(): > if (x = 2): > ... > > That's a bizarre distinction. Chris, FWIW I'm trying to avoid using 'bizarre', 'arcane' etc with regards to PEP 572 or any proposal, really. For example, I, personally, find ':=' bizarre, but it's subjective and it's unproductive to say that. Yury _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com