Everybody knows that in Python assignments do not return a value, presumably to avoid assignments on if statements when usually just a comparison is intended:
>>> if a = b:
File "<stdin>", line 1
if a = b:
^
SyntaxError: invalid syntax
>>> if a == b:
... pass
...
For the same reason, one could suspect that multiple assignments on the same statement were also syntax errors.
In fact, a = (b = 2) is not a valid expression:
>>> a = (b = 2)
File "<stdin>", line 1
a = (b = 2)
^
SyntaxError: invalid syntax
So, my question is: why a = b = 2 works in Python as it works in other languages where assignment statements have a value, like C?
>>> a = b = c = 2
>>> a, b, c
(2, 2, 2)
Is this behavior documented? I could not found anything about this in the assignment statement documentation: http://docs.python.org/reference/simple_stmts.html#assignment-statements