mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Fixing bug
[#448679] Left to right * Python/compile.c (com_dictmaker): Reordered evaluation of dictionaries to follow strict LTR evaluation. * Lib/compiler/pycodegen.py (CodeGenerator.visitDict): Reordered evaluation of dictionaries to follow strict LTR evaluation. * Doc/ref/ref5.tex Documented the general LTR evaluation order idea. * Misc/NEWS Documented change in evaluation order of dictionaries.
This commit is contained in:
parent
c389ec8d55
commit
78429a6aa6
4 changed files with 26 additions and 4 deletions
|
@ -1026,6 +1026,24 @@ tuple, but rather yields the value of that expression.
|
|||
\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}}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue