Search code examples
pythonpython-assignment-expression

Why is the walrus operator not a delimiter?


The Python walrus operator (:=) is listed in the documentation as an operator, but not as a delimiter like the rest of the assignment operators (e.g. +=). Why then is the walrus operation not also a delimiter?


Solution

  • You write “the rest of the assignment operators”, but there is only one assignment operator in Python, and that’s the walrus operator! The other assignment... thingies are delimiters in an assignment statement.