On Tue, Apr 24, 2018 at 11:27 AM, Steven D'Aprano <st...@pearwood.info> wrote: > On Tue, Apr 24, 2018 at 11:03:35AM -0400, Yury Selivanov wrote: > >> My point was that when you see lots of '=' and ':=' used at the >> statement level, one might try to write "if x = 1" instead of "if x := >> 1" -- boom, we have an unexpected SyntaxError for some users. > > That's a *good* thing. They will then learn not to write x = 1 as an > expression. > > Also, if I write lots of x := 1 binding-expressions as statements, my > code is bad and deserves to fail code-review. But why would I write the > extra colon (one character, two key-presses) to use > > x := 1 > > as a statement, when x = 1 will work? That's a sure sign that I don't > know what I'm doing. (Or that I desperately wish I was writing Pascal.)
In JavaScript there's a new backticks syntax for string—their variant of f-strings. I'm seeing a lot of JS coders that use backticks everywhere, regardless if there's formatting in them or not. The result is that some JS code in popular libraries has now *three* different string literal syntaxes separated by one line of code. It looks weird. I expect to see something similar in Python code if we adapt ':='. I don't think the language will benefit from this. FWIW I'm fine with keeping the status quo and not adding new syntax at all. 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