Skip to content

Commit ba01dd9

Browse files
committed
Merged revisions 69769,69776 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r69769 | georg.brandl | 2009-02-19 02:30:06 -0600 (Thu, 19 Feb 2009) | 1 line #5310, #3558: fix operator precedence table. ........ r69776 | georg.brandl | 2009-02-19 10:34:51 -0600 (Thu, 19 Feb 2009) | 2 lines #5317: update IronPython URL. ........
1 parent 93d83da commit ba01dd9

2 files changed

Lines changed: 47 additions & 55 deletions

File tree

Doc/reference/expressions.rst

Lines changed: 46 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -785,14 +785,14 @@ number. (In earlier versions it raised a :exc:`ValueError`.)
785785

786786
.. _unary:
787787

788-
Unary arithmetic operations
789-
===========================
788+
Unary arithmetic and bitwise operations
789+
=======================================
790790

791791
.. index::
792792
triple: unary; arithmetic; operation
793793
triple: unary; bitwise; operation
794794

795-
All unary arithmetic (and bitwise) operations have the same priority:
795+
All unary arithmetic and bitwise operations have the same priority:
796796

797797
.. productionlist::
798798
u_expr: `power` | "-" `u_expr` | "+" `u_expr` | "~" `u_expr`
@@ -1240,56 +1240,46 @@ comparisons, including tests, which all have the same precedence and chain from
12401240
left to right --- see section :ref:`comparisons` --- and exponentiation, which
12411241
groups from right to left).
12421242

1243-
+----------------------------------------------+-------------------------------------+
1244-
| Operator | Description |
1245-
+==============================================+=====================================+
1246-
| :keyword:`lambda` | Lambda expression |
1247-
+----------------------------------------------+-------------------------------------+
1248-
| :keyword:`or` | Boolean OR |
1249-
+----------------------------------------------+-------------------------------------+
1250-
| :keyword:`and` | Boolean AND |
1251-
+----------------------------------------------+-------------------------------------+
1252-
| :keyword:`not` *x* | Boolean NOT |
1253-
+----------------------------------------------+-------------------------------------+
1254-
| :keyword:`in`, :keyword:`not` :keyword:`in` | Membership tests |
1255-
+----------------------------------------------+-------------------------------------+
1256-
| :keyword:`is`, :keyword:`is not` | Identity tests |
1257-
+----------------------------------------------+-------------------------------------+
1258-
| ``<``, ``<=``, ``>``, ``>=``, ``!=``, ``==`` | Comparisons |
1259-
+----------------------------------------------+-------------------------------------+
1260-
| ``|`` | Bitwise OR |
1261-
+----------------------------------------------+-------------------------------------+
1262-
| ``^`` | Bitwise XOR |
1263-
+----------------------------------------------+-------------------------------------+
1264-
| ``&`` | Bitwise AND |
1265-
+----------------------------------------------+-------------------------------------+
1266-
| ``<<``, ``>>`` | Shifts |
1267-
+----------------------------------------------+-------------------------------------+
1268-
| ``+``, ``-`` | Addition and subtraction |
1269-
+----------------------------------------------+-------------------------------------+
1270-
| ``*``, ``/``, ``//``, ``%`` | Multiplication, division, remainder |
1271-
+----------------------------------------------+-------------------------------------+
1272-
| ``+x``, ``-x`` | Positive, negative |
1273-
+----------------------------------------------+-------------------------------------+
1274-
| ``~x`` | Bitwise not |
1275-
+----------------------------------------------+-------------------------------------+
1276-
| ``**`` | Exponentiation |
1277-
+----------------------------------------------+-------------------------------------+
1278-
| ``x[index]`` | Subscription |
1279-
+----------------------------------------------+-------------------------------------+
1280-
| ``x[index:index]`` | Slicing |
1281-
+----------------------------------------------+-------------------------------------+
1282-
| ``x(arguments...)`` | Call |
1283-
+----------------------------------------------+-------------------------------------+
1284-
| ``x.attribute`` | Attribute reference |
1285-
+----------------------------------------------+-------------------------------------+
1286-
| ``(expressions...)`` | Binding, tuple display, generator |
1287-
| | expressions |
1288-
+----------------------------------------------+-------------------------------------+
1289-
| ``[expressions...]`` | List display |
1290-
+----------------------------------------------+-------------------------------------+
1291-
| ``{expressions...}`` | Dictionary or set display |
1292-
+----------------------------------------------+-------------------------------------+
1243+
1244+
+-----------------------------------------------+-------------------------------------+
1245+
| Operator | Description |
1246+
+===============================================+=====================================+
1247+
| :keyword:`lambda` | Lambda expression |
1248+
+-----------------------------------------------+-------------------------------------+
1249+
| :keyword:`or` | Boolean OR |
1250+
+-----------------------------------------------+-------------------------------------+
1251+
| :keyword:`and` | Boolean AND |
1252+
+-----------------------------------------------+-------------------------------------+
1253+
| :keyword:`not` *x* | Boolean NOT |
1254+
+-----------------------------------------------+-------------------------------------+
1255+
| :keyword:`in`, :keyword:`not` :keyword:`in`, | Comparisons, including membership |
1256+
| :keyword:`is`, :keyword:`is not`, ``<``, | tests and identity tests, |
1257+
| ``<=``, ``>``, ``>=``, ``<>``, ``!=``, ``==`` | |
1258+
+-----------------------------------------------+-------------------------------------+
1259+
| ``|`` | Bitwise OR |
1260+
+-----------------------------------------------+-------------------------------------+
1261+
| ``^`` | Bitwise XOR |
1262+
+-----------------------------------------------+-------------------------------------+
1263+
| ``&`` | Bitwise AND |
1264+
+-----------------------------------------------+-------------------------------------+
1265+
| ``<<``, ``>>`` | Shifts |
1266+
+-----------------------------------------------+-------------------------------------+
1267+
| ``+``, ``-`` | Addition and subtraction |
1268+
+-----------------------------------------------+-------------------------------------+
1269+
| ``*``, ``/``, ``//``, ``%`` | Multiplication, division, remainder |
1270+
+-----------------------------------------------+-------------------------------------+
1271+
| ``+x``, ``-x``, ``~x`` | Positive, negative, bitwise NOT |
1272+
+-----------------------------------------------+-------------------------------------+
1273+
| ``**`` | Exponentiation [#]_ |
1274+
+-----------------------------------------------+-------------------------------------+
1275+
| ``x[index]``, ``x[index:index]``, | Subscription, slicing, |
1276+
| ``x(arguments...)``, ``x.attribute`` | call, attribute reference |
1277+
+-----------------------------------------------+-------------------------------------+
1278+
| ``(expressions...)``, | Binding or tuple display, |
1279+
| ``[expressions...]``, | list display, |
1280+
| ``{key:datum...}``, | dictionary display, |
1281+
+-----------------------------------------------+-------------------------------------+
1282+
12931283

12941284
.. rubric:: Footnotes
12951285

@@ -1327,3 +1317,6 @@ groups from right to left).
13271317
descriptors, you may notice seemingly unusual behaviour in certain uses of
13281318
the :keyword:`is` operator, like those involving comparisons between instance
13291319
methods, or constants. Check their documentation for more info.
1320+
1321+
.. [#] The power operator ``**`` binds less tightly than an arithmetic or
1322+
bitwise unary operator on its right, that is, ``2**-1`` is ``0.5``.

Doc/reference/introduction.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ IronPython
6666
An alternate Python for .NET. Unlike Python.NET, this is a complete Python
6767
implementation that generates IL, and compiles Python code directly to .NET
6868
assemblies. It was created by Jim Hugunin, the original creator of Jython. For
69-
more information, see `the IronPython website
70-
<http://workspaces.gotdotnet.com/ironpython>`_.
69+
more information, see `the IronPython website <http://www.ironpython.com/>`_.
7170

7271
PyPy
7372
An implementation of Python written in Python; even the bytecode interpreter is

0 commit comments

Comments
 (0)