[Python-Dev] PEP 572: Why not := as standard assignment operator?

Chris Angelico rosuav at gmail.com
Thu Apr 26 11:18:08 EDT 2018

On Thu, Apr 26, 2018 at 11:13 PM, Martin Teichmann
<lkb.teichmann at 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".

For further details, search the archives. Please don't reply to debate
this point. :)


More information about the Python-Dev mailing list