News for hackers. Stuff that matters.
Re:Python Multiple Assignment Is a Puzzle by Someone on Sunday July 27, 2014 @01:59PM (#8093423)
I think that specification still can be improved. It is clear about order of evaluation, but not on the order of assignment.

Does it do tmp3 = expr1 tmp4 = expr2

   expr3 = tmp3
   expr4 = tmp4
or

   expr3 = expr1
   expr4 = expr2
? I guess it is the latter, but the text does not make that clear.
Re:Python Multiple Assignment Is a Puzzle by zwegner on Sunday July 27, 2014 @02:11PM (#8093449)
The first--the latter isn't in order (expr3 is "evaluated" before expr2, which in this case means assignment).
Re:Python Multiple Assignment Is a Puzzle by Someone on Sunday July 27, 2014 @03:30PM (#8093703)
That's precisely the place where I think the description can be improved. With complex assignments, there are two parts: compute the place to store a value, and store the value there. In my mental model, the latter is better called assignment than evaluation.
Re:Python Multiple Assignment Is a Puzzle by zwegner on Sunday July 27, 2014 @04:42PM (#8093913)
With Python's evaluation/assignment order, both parts of a complex assignment happen at once--which is the source of the weird behavior in the article (A[0] is assigned to before the subscript of A[A[0] - 1] is evaluated).