On 26 April 2018 at 16:18, Chris Angelico <rosuav@gmail.com> wrote:
On Thu, Apr 26, 2018 at 11:13 PM, Martin Teichmann
<lkb.teichmann@gmail.com> wrote:
> Hi list,
> when reading PEP 572 I actually liked it a lot - I think it's actually
> a cool idea. I think it's actually that cool an idea that it should be
> made the default way of doing an assignment, over time phasing out the
> good ole =.
> This would have several benefits:
> - people wouldn't have to worry about two different options
> - different things would have a different look: assignment is :=,
> keyword args is =, while comparison is ==. Especially beginners would
> benefit from this clarity.
> in this case, for sure, we should make it possible to chain :=s, for
> example by making it bind right-to-left, so that  a := b := 3 would be
> a := (b := 3)
> I'm sorry if somebody brought that up already, but the discussion has
> grown so huge that I couldn't read through it entirely.

It has indeed grown huge. And in the interests of not growing it even
huger, I'm not going to rehash the arguments against making := into
the one and only operator, save to say one thing: there's no way that
"x = 1" can be removed from the language any time soon, and by "soon"
I mean even by the Yes Prime Minister definition, where "any day now",
in strategic terms, meant "within the next half century".
In the interest of that, do you think := can be made illegal, by the grammar, if used outside an expression?

a = 1  # legal
a := 1  # Syntax error
if a := 1:  # legal

Thanks in advance.

Gustavo J. A. M. Carneiro
Gambit Research
"The universe is always one step beyond logic." -- Frank Herbert