diff options
author | Gustavo Niemeyer <gustavo@niemeyer.net> | 2002-12-16 13:54:02 (GMT) |
---|---|---|
committer | Gustavo Niemeyer <gustavo@niemeyer.net> | 2002-12-16 13:54:02 (GMT) |
commit | 78429a6aa6bb4f8527f0c6be678555ef26b62d19 (patch) | |
tree | e733c09ec2db70d79822c60895286ffacd97e003 /Doc/ref | |
parent | c389ec8d55efe0a812906ec68cf5c690290b3428 (diff) | |
download | cpython-78429a6aa6bb4f8527f0c6be678555ef26b62d19.zip cpython-78429a6aa6bb4f8527f0c6be678555ef26b62d19.tar.gz cpython-78429a6aa6bb4f8527f0c6be678555ef26b62d19.tar.bz2 |
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.
Diffstat (limited to 'Doc/ref')
-rw-r--r-- | Doc/ref/ref5.tex | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Doc/ref/ref5.tex b/Doc/ref/ref5.tex index 34c99ef..c0212d0 100644 --- a/Doc/ref/ref5.tex +++ b/Doc/ref/ref5.tex @@ -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}} |