@@ -1905,8 +1905,23 @@ Evaluation order
19051905
19061906.. index :: pair: evaluation; order
19071907
1908- Python evaluates expressions from left to right. Notice that while evaluating
1909- an assignment, the right-hand side is evaluated before the left-hand side.
1908+ Python evaluates expressions from left to right (except for conditional_expression).
1909+ Notice that while evaluating an assignment, the right-hand side is evaluated before
1910+ the left-hand side.
1911+
1912+ Examples for left to right:
1913+
1914+ .. code-block :: python
1915+
1916+ 2 + 3 * 4 / 2 - 1
1917+ 7
1918+
1919+ Following is an example of right to left conditional_expression evaluation example:
1920+
1921+ .. code-block :: python
1922+
1923+ ' foo' if 1 else ' bar' if 0 else ' baz'
1924+ ' foo'
19101925
19111926 In the following lines, expressions will be evaluated in the arithmetic order of
19121927their suffixes::
@@ -1930,8 +1945,11 @@ Operator precedence
19301945The following table summarizes the operator precedence in Python, from highest
19311946precedence (most binding) to lowest precedence (least binding). Operators in
19321947the same box have the same precedence. Unless the syntax is explicitly given,
1933- operators are binary. Operators in the same box group left to right (except for
1934- exponentiation and conditional expressions, which group from right to left).
1948+ operators are binary. Operators in the same box group left to right (except for
1949+ comparisons, including tests, exponentiation and conditional expressions, which
1950+ group from right to left which all have the same precedence and chain from left
1951+ to right — see section Comparisons — and exponentiation, which groups from right
1952+ to left)
19351953
19361954Note that comparisons, membership tests, and identity tests, all have the same
19371955precedence and have a left-to-right chaining feature as described in the
0 commit comments