summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-04-19 08:56:38 -0700
committerGitHub <noreply@github.com>2021-04-19 08:56:38 -0700
commit072ec69af592611f36349f5048569ab7e72b8b61 (patch)
treedfc8cf113aa70fc2d03891a62fd0660f5b22b8b3
parent0121f6792ab49c575e4c34f587d486e1fda85674 (diff)
downloadcpython-git-072ec69af592611f36349f5048569ab7e72b8b61.tar.gz
bpo-43837: Reverse order of precedence table to show tightly binding operators first (GH-25469) (GH-25472)
-rw-r--r--Doc/reference/expressions.rst58
1 files changed, 29 insertions, 29 deletions
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst
index e7b1d3838b..3bb3834ce0 100644
--- a/Doc/reference/expressions.rst
+++ b/Doc/reference/expressions.rst
@@ -1807,8 +1807,8 @@ Operator precedence
.. index::
pair: operator; precedence
-The following table summarizes the operator precedence in Python, from lowest
-precedence (least binding) to highest precedence (most binding). Operators in
+The following table summarizes the operator precedence in Python, from highest
+precedence (most binding) to lowest precedence (least binding). Operators in
the same box have the same precedence. Unless the syntax is explicitly given,
operators are binary. Operators in the same box group left to right (except for
exponentiation, which groups from right to left).
@@ -1821,50 +1821,50 @@ precedence and have a left-to-right chaining feature as described in the
+-----------------------------------------------+-------------------------------------+
| Operator | Description |
+===============================================+=====================================+
-| ``:=`` | Assignment expression |
-+-----------------------------------------------+-------------------------------------+
-| :keyword:`lambda` | Lambda expression |
+| ``(expressions...)``, | Binding or parenthesized |
+| | expression, |
+| ``[expressions...]``, | list display, |
+| ``{key: value...}``, | dictionary display, |
+| ``{expressions...}`` | set display |
+-----------------------------------------------+-------------------------------------+
-| :keyword:`if <if_expr>` -- :keyword:`!else` | Conditional expression |
+| ``x[index]``, ``x[index:index]``, | Subscription, slicing, |
+| ``x(arguments...)``, ``x.attribute`` | call, attribute reference |
+-----------------------------------------------+-------------------------------------+
-| :keyword:`or` | Boolean OR |
+| :keyword:`await` ``x`` | Await expression |
+-----------------------------------------------+-------------------------------------+
-| :keyword:`and` | Boolean AND |
+| ``**`` | Exponentiation [#]_ |
+-----------------------------------------------+-------------------------------------+
-| :keyword:`not` ``x`` | Boolean NOT |
+| ``+x``, ``-x``, ``~x`` | Positive, negative, bitwise NOT |
+-----------------------------------------------+-------------------------------------+
-| :keyword:`in`, :keyword:`not in`, | Comparisons, including membership |
-| :keyword:`is`, :keyword:`is not`, ``<``, | tests and identity tests |
-| ``<=``, ``>``, ``>=``, ``!=``, ``==`` | |
+| ``*``, ``@``, ``/``, ``//``, ``%`` | Multiplication, matrix |
+| | multiplication, division, floor |
+| | division, remainder [#]_ |
+-----------------------------------------------+-------------------------------------+
-| ``|`` | Bitwise OR |
+| ``+``, ``-`` | Addition and subtraction |
+-----------------------------------------------+-------------------------------------+
-| ``^`` | Bitwise XOR |
+| ``<<``, ``>>`` | Shifts |
+-----------------------------------------------+-------------------------------------+
| ``&`` | Bitwise AND |
+-----------------------------------------------+-------------------------------------+
-| ``<<``, ``>>`` | Shifts |
+| ``^`` | Bitwise XOR |
+-----------------------------------------------+-------------------------------------+
-| ``+``, ``-`` | Addition and subtraction |
+| ``|`` | Bitwise OR |
+-----------------------------------------------+-------------------------------------+
-| ``*``, ``@``, ``/``, ``//``, ``%`` | Multiplication, matrix |
-| | multiplication, division, floor |
-| | division, remainder [#]_ |
+| :keyword:`in`, :keyword:`not in`, | Comparisons, including membership |
+| :keyword:`is`, :keyword:`is not`, ``<``, | tests and identity tests |
+| ``<=``, ``>``, ``>=``, ``!=``, ``==`` | |
+-----------------------------------------------+-------------------------------------+
-| ``+x``, ``-x``, ``~x`` | Positive, negative, bitwise NOT |
+| :keyword:`not` ``x`` | Boolean NOT |
+-----------------------------------------------+-------------------------------------+
-| ``**`` | Exponentiation [#]_ |
+| :keyword:`and` | Boolean AND |
+-----------------------------------------------+-------------------------------------+
-| :keyword:`await` ``x`` | Await expression |
+| :keyword:`or` | Boolean OR |
+-----------------------------------------------+-------------------------------------+
-| ``x[index]``, ``x[index:index]``, | Subscription, slicing, |
-| ``x(arguments...)``, ``x.attribute`` | call, attribute reference |
+| :keyword:`if <if_expr>` -- :keyword:`!else` | Conditional expression |
+-----------------------------------------------+-------------------------------------+
-| ``(expressions...)``, | Binding or parenthesized |
-| | expression, |
-| ``[expressions...]``, | list display, |
-| ``{key: value...}``, | dictionary display, |
-| ``{expressions...}`` | set display |
+| :keyword:`lambda` | Lambda expression |
++-----------------------------------------------+-------------------------------------+
+| ``:=`` | Assignment expression |
+-----------------------------------------------+-------------------------------------+