Gabriel Nistor added the comment:
Thanks for the fast reply. The explanation seems valid, but the behavior is not
consistent with other high level languages, and also with plain reasoning. I
have a big java background experience and I am now with python for almost 3
years doing really hard
R. David Murray added the comment:
Well, it is consistent with plain reasoning if you remember that (a) python is
a dynamic language and (b) python assignments do not return values (this is a
core principle in the language design), which means that (c) the chained
assignment form is a
R. David Murray added the comment:
I agree that this is somewhat surprising, but it is working as intended.
a = b = c
is equivalent to
a = c
b = c
except that the RHS is evaluated only once, which can be important.
You were either expecting it to be equivalent to
b = c
a = c