summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2011-03-23 00:34:28 (GMT)
committerRaymond Hettinger <python@rcn.com>2011-03-23 00:34:28 (GMT)
commitf59c7b2bddbeb552dac8a1fc8c800c7789c81331 (patch)
tree5abd48a2c394fcb11cdd92d52d2fb73ca18ae76d
parent941b2c99f6cd076baf536689ec14f66078c4bd54 (diff)
parentb1aef23316b093e042bc6afa7e52cd9d7c95802c (diff)
downloadcpython-f59c7b2bddbeb552dac8a1fc8c800c7789c81331.zip
cpython-f59c7b2bddbeb552dac8a1fc8c800c7789c81331.tar.gz
cpython-f59c7b2bddbeb552dac8a1fc8c800c7789c81331.tar.bz2
Issue #10610: Document that int(), float(), and complex() accept numeric literals with the Nd property.
-rw-r--r--Doc/library/stdtypes.rst86
1 files changed, 46 insertions, 40 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index 6fab5c6..2415e39 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -268,46 +268,46 @@ All numeric types (except complex) support the following operations, sorted by
ascending priority (operations in the same box have the same priority; all
numeric operations have a higher priority than comparison operations):
-+---------------------+---------------------------------+-------+--------------------+
-| Operation | Result | Notes | Full documentation |
-+=====================+=================================+=======+====================+
-| ``x + y`` | sum of *x* and *y* | | |
-+---------------------+---------------------------------+-------+--------------------+
-| ``x - y`` | difference of *x* and *y* | | |
-+---------------------+---------------------------------+-------+--------------------+
-| ``x * y`` | product of *x* and *y* | | |
-+---------------------+---------------------------------+-------+--------------------+
-| ``x / y`` | quotient of *x* and *y* | | |
-+---------------------+---------------------------------+-------+--------------------+
-| ``x // y`` | floored quotient of *x* and | \(1) | |
-| | *y* | | |
-+---------------------+---------------------------------+-------+--------------------+
-| ``x % y`` | remainder of ``x / y`` | \(2) | |
-+---------------------+---------------------------------+-------+--------------------+
-| ``-x`` | *x* negated | | |
-+---------------------+---------------------------------+-------+--------------------+
-| ``+x`` | *x* unchanged | | |
-+---------------------+---------------------------------+-------+--------------------+
-| ``abs(x)`` | absolute value or magnitude of | | :func:`abs` |
-| | *x* | | |
-+---------------------+---------------------------------+-------+--------------------+
-| ``int(x)`` | *x* converted to integer | \(3) | :func:`int` |
-+---------------------+---------------------------------+-------+--------------------+
-| ``float(x)`` | *x* converted to floating point | \(4) | :func:`float` |
-+---------------------+---------------------------------+-------+--------------------+
-| ``complex(re, im)`` | a complex number with real part | | :func:`complex` |
-| | *re*, imaginary part *im*. | | |
-| | *im* defaults to zero. | | |
-+---------------------+---------------------------------+-------+--------------------+
-| ``c.conjugate()`` | conjugate of the complex number | | |
-| | *c* | | |
-+---------------------+---------------------------------+-------+--------------------+
-| ``divmod(x, y)`` | the pair ``(x // y, x % y)`` | \(2) | :func:`divmod` |
-+---------------------+---------------------------------+-------+--------------------+
-| ``pow(x, y)`` | *x* to the power *y* | \(5) | :func:`pow` |
-+---------------------+---------------------------------+-------+--------------------+
-| ``x ** y`` | *x* to the power *y* | \(5) | |
-+---------------------+---------------------------------+-------+--------------------+
++---------------------+---------------------------------+---------+--------------------+
+| Operation | Result | Notes | Full documentation |
++=====================+=================================+=========+====================+
+| ``x + y`` | sum of *x* and *y* | | |
++---------------------+---------------------------------+---------+--------------------+
+| ``x - y`` | difference of *x* and *y* | | |
++---------------------+---------------------------------+---------+--------------------+
+| ``x * y`` | product of *x* and *y* | | |
++---------------------+---------------------------------+---------+--------------------+
+| ``x / y`` | quotient of *x* and *y* | | |
++---------------------+---------------------------------+---------+--------------------+
+| ``x // y`` | floored quotient of *x* and | \(1) | |
+| | *y* | | |
++---------------------+---------------------------------+---------+--------------------+
+| ``x % y`` | remainder of ``x / y`` | \(2) | |
++---------------------+---------------------------------+---------+--------------------+
+| ``-x`` | *x* negated | | |
++---------------------+---------------------------------+---------+--------------------+
+| ``+x`` | *x* unchanged | | |
++---------------------+---------------------------------+---------+--------------------+
+| ``abs(x)`` | absolute value or magnitude of | | :func:`abs` |
+| | *x* | | |
++---------------------+---------------------------------+---------+--------------------+
+| ``int(x)`` | *x* converted to integer | \(3)\(6)| :func:`int` |
++---------------------+---------------------------------+---------+--------------------+
+| ``float(x)`` | *x* converted to floating point | \(4)\(6)| :func:`float` |
++---------------------+---------------------------------+---------+--------------------+
+| ``complex(re, im)`` | a complex number with real part | \(6) | :func:`complex` |
+| | *re*, imaginary part *im*. | | |
+| | *im* defaults to zero. | | |
++---------------------+---------------------------------+---------+--------------------+
+| ``c.conjugate()`` | conjugate of the complex number | | |
+| | *c* | | |
++---------------------+---------------------------------+---------+--------------------+
+| ``divmod(x, y)`` | the pair ``(x // y, x % y)`` | \(2) | :func:`divmod` |
++---------------------+---------------------------------+---------+--------------------+
+| ``pow(x, y)`` | *x* to the power *y* | \(5) | :func:`pow` |
++---------------------+---------------------------------+---------+--------------------+
+| ``x ** y`` | *x* to the power *y* | \(5) | |
++---------------------+---------------------------------+---------+--------------------+
.. index::
triple: operations on; numeric; types
@@ -346,6 +346,12 @@ Notes:
Python defines ``pow(0, 0)`` and ``0 ** 0`` to be ``1``, as is common for
programming languages.
+(6)
+ The numeric literals accepted include the digits ``0`` to ``9`` or any
+ Unicode equivalent (code points with the ``Nd`` property).
+
+ See http://www.unicode.org/Public/6.0.0/ucd/extracted/DerivedNumericType.txt
+ for a complete list of code points with the ``Nd`` property.
All :class:`numbers.Real` types (:class:`int` and