This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients benjamin.peterson, chupym, r.david.murray
Date 2013-01-24.13:46:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1359035202.33.0.571079462263.issue17022@psf.upfronthosting.co.za>
In-reply-to
Content
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

or expecting all of the LHS expressions to be evaluated before any assignments were done.

It could have been implemented any of these ways (though the last one is much more complex to implement). Python chose the first way.

There is a specific warning about this in the documentation, at the end of the section on assignment statements:

http://docs.python.org/3/reference/simple_stmts.html#assignment-statements
History
Date User Action Args
2013-01-24 13:46:42r.david.murraysetrecipients: + r.david.murray, benjamin.peterson, chupym
2013-01-24 13:46:42r.david.murraysetmessageid: <1359035202.33.0.571079462263.issue17022@psf.upfronthosting.co.za>
2013-01-24 13:46:42r.david.murraylinkissue17022 messages
2013-01-24 13:46:41r.david.murraycreate