@@ -1807,8 +1807,8 @@ Operator precedence
1807
1807
.. index ::
1808
1808
pair: operator; precedence
1809
1809
1810
- The following table summarizes the operator precedence in Python, from lowest
1811
- precedence (least binding) to highest precedence (most binding). Operators in
1810
+ The following table summarizes the operator precedence in Python, from highest
1811
+ precedence (most binding) to lowest precedence (least binding). Operators in
1812
1812
the same box have the same precedence. Unless the syntax is explicitly given,
1813
1813
operators are binary. Operators in the same box group left to right (except for
1814
1814
exponentiation, which groups from right to left).
@@ -1821,50 +1821,50 @@ precedence and have a left-to-right chaining feature as described in the
1821
1821
+-----------------------------------------------+-------------------------------------+
1822
1822
| Operator | Description |
1823
1823
+===============================================+=====================================+
1824
- | ``:= `` | Assignment expression |
1825
- +-----------------------------------------------+-------------------------------------+
1826
- | :keyword: `lambda ` | Lambda expression |
1824
+ | ``(expressions...) ``, | Binding or parenthesized |
1825
+ | | expression, |
1826
+ | ``[expressions...] ``, | list display, |
1827
+ | ``{key: value...} ``, | dictionary display, |
1828
+ | ``{expressions...} `` | set display |
1827
1829
+-----------------------------------------------+-------------------------------------+
1828
- | :keyword: `if <if_expr> ` -- :keyword: `!else ` | Conditional expression |
1830
+ | ``x[index] ``, ``x[index:index] ``, | Subscription, slicing, |
1831
+ | ``x(arguments...) ``, ``x.attribute `` | call, attribute reference |
1829
1832
+-----------------------------------------------+-------------------------------------+
1830
- | :keyword: `or ` | Boolean OR |
1833
+ | :keyword: `await ` `` x `` | Await expression |
1831
1834
+-----------------------------------------------+-------------------------------------+
1832
- | :keyword: ` and ` | Boolean AND |
1835
+ | `` ** `` | Exponentiation [ # ]_ |
1833
1836
+-----------------------------------------------+-------------------------------------+
1834
- | :keyword: ` not ` ``x `` | Boolean NOT |
1837
+ | `` +x ``, ``- x ``, `` ~x `` | Positive, negative, bitwise NOT |
1835
1838
+-----------------------------------------------+-------------------------------------+
1836
- | :keyword: ` in `, :keyword: ` not in `, | Comparisons, including membership |
1837
- | :keyword: ` is `, :keyword: ` is not `, `` < ``, | tests and identity tests |
1838
- | `` <= ``, `` > ``, `` >= ``, `` != ``, `` == `` | |
1839
+ | `` * ``, `` @ ``, `` / ``, `` // ``, `` % `` | Multiplication, matrix |
1840
+ | | multiplication, division, floor |
1841
+ | | division, remainder [ # ]_ |
1839
1842
+-----------------------------------------------+-------------------------------------+
1840
- | ``| `` | Bitwise OR |
1843
+ | ``+ ``, `` - `` | Addition and subtraction |
1841
1844
+-----------------------------------------------+-------------------------------------+
1842
- | ``^ `` | Bitwise XOR |
1845
+ | ``<< ``, `` >> `` | Shifts |
1843
1846
+-----------------------------------------------+-------------------------------------+
1844
1847
| ``& `` | Bitwise AND |
1845
1848
+-----------------------------------------------+-------------------------------------+
1846
- | ``<< ``, `` >> `` | Shifts |
1849
+ | ``^ `` | Bitwise XOR |
1847
1850
+-----------------------------------------------+-------------------------------------+
1848
- | ``+ ``, `` - `` | Addition and subtraction |
1851
+ | ``| `` | Bitwise OR |
1849
1852
+-----------------------------------------------+-------------------------------------+
1850
- | `` * ``, `` @ ``, `` / ``, `` // ``, `` % `` | Multiplication, matrix |
1851
- | | multiplication, division, floor |
1852
- | | division, remainder [ # ]_ |
1853
+ | :keyword: ` in `, :keyword: ` not in `, | Comparisons, including membership |
1854
+ | :keyword: ` is `, :keyword: ` is not `, `` < ``, | tests and identity tests |
1855
+ | `` <= ``, `` > ``, `` >= ``, `` != ``, `` == `` | |
1853
1856
+-----------------------------------------------+-------------------------------------+
1854
- | `` +x ``, ``- x ``, `` ~x `` | Positive, negative, bitwise NOT |
1857
+ | :keyword: ` not ` ``x `` | Boolean NOT |
1855
1858
+-----------------------------------------------+-------------------------------------+
1856
- | `` ** `` | Exponentiation [ # ]_ |
1859
+ | :keyword: ` and ` | Boolean AND |
1857
1860
+-----------------------------------------------+-------------------------------------+
1858
- | :keyword: `await ` `` x `` | Await expression |
1861
+ | :keyword: `or ` | Boolean OR |
1859
1862
+-----------------------------------------------+-------------------------------------+
1860
- | ``x[index] ``, ``x[index:index] ``, | Subscription, slicing, |
1861
- | ``x(arguments...) ``, ``x.attribute `` | call, attribute reference |
1863
+ | :keyword: `if <if_expr> ` -- :keyword: `!else ` | Conditional expression |
1862
1864
+-----------------------------------------------+-------------------------------------+
1863
- | ``(expressions...) ``, | Binding or parenthesized |
1864
- | | expression, |
1865
- | ``[expressions...] ``, | list display, |
1866
- | ``{key: value...} ``, | dictionary display, |
1867
- | ``{expressions...} `` | set display |
1865
+ | :keyword: `lambda ` | Lambda expression |
1866
+ +-----------------------------------------------+-------------------------------------+
1867
+ | ``:= `` | Assignment expression |
1868
1868
+-----------------------------------------------+-------------------------------------+
1869
1869
1870
1870
0 commit comments