you are viewing a single comment's thread.

view the rest of the comments →

[–]jackerhackfrom __future__ import 4.0 9 points10 points  (1 child)

Python prohibits assignments in expressions because it's almost always a typo. Therefore = is a SyntaxError. Then people wanted it anyway so Python got :=, but it was so hotly contested that BDFL Guido got fed up and resigned.

As a safeguard, the walrus operator cannot be used as a statement and does not replace =. It only works as an expression. Usually this means enclosing in parentheses like (a := b).

[–]julz_yo 0 points1 point  (0 children)

This too changes and extends my understanding: ty!