Index: Lib/compiler/pycodegen.py =================================================================== --- Lib/compiler/pycodegen.py +++ Lib/compiler/pycodegen.py 2002-11-26 19:53:19.000000000 -0200 @@ -1129,9 +1129,9 @@ self.emit('SET_LINENO', lineno2) lineno = lineno2 self.emit('DUP_TOP') - self.visit(v) - self.emit('ROT_TWO') self.visit(k) + self.visit(v) + self.emit('ROT_THREE') self.emit('STORE_SUBSCR') class NestedScopeMixin: Index: Python/compile.c =================================================================== --- Python/compile.c +++ Python/compile.c 2002-11-26 19:16:36.000000000 -0200 @@ -1527,9 +1527,9 @@ It wants the stack to look like (value) (dict) (key) */ com_addbyte(c, DUP_TOP); com_push(c, 1); - com_node(c, CHILD(n, i+2)); /* value */ - com_addbyte(c, ROT_TWO); com_node(c, CHILD(n, i)); /* key */ + com_node(c, CHILD(n, i+2)); /* value */ + com_addbyte(c, ROT_THREE); com_addbyte(c, STORE_SUBSCR); com_pop(c, 3); } Index: Doc/ref/ref5.tex =================================================================== --- Doc/ref/ref5.tex +++ Doc/ref/ref5.tex 2002-11-26 19:14:54.000000000 -0200 @@ -1026,6 +1026,24 @@ \code{()}.) \indexii{trailing}{comma} +\section{Evaluation order\label{evalorder}} +\indexii{evaluation}{order} + +Python evaluates expressions from left to right. Notice that while +evaluating an assignment, the right-hand side is evaluated before +the left-hand side. + +In the following lines, expressions will be evaluated in the +arithmetic order of their suffixes: + +\begin{verbatim} +expr1, expr2, expr3, expr4 +(expr1, expr2, expr3, expr4) +{expr1: expr2, expr3: expr4} +expr1 + expr2 * (expr3 - expr4) +func(expr1, expr2, *expr3, **expr4) +expr3, expr4 = expr1, expr2 +\end{verbatim} \section{Summary\label{summary}}