Backport PEP 3141 from the py3k branch to the trunk. This includes r50877 (just

the complex_pow part), r56649, r56652, r56715, r57296, r57302, r57359, r57361,
r57372, r57738, r57739, r58017, r58039, r58040, and r59390, and new
documentation. The only significant difference is that round(x) returns a float
to preserve backward-compatibility. See http://bugs.python.org/issue1689.
This commit is contained in:
Jeffrey Yasskin 2008-01-03 02:21:52 +00:00
parent 27edd829d7
commit 2f3c16be73
21 changed files with 1089 additions and 124 deletions

View file

@ -150,7 +150,7 @@ Ellipsis
indicate the presence of the ``...`` syntax in a slice. Its truth value is
true.
Numbers
:class:`numbers.Number`
.. index:: object: numeric
These are created by numeric literals and returned as results by arithmetic
@ -162,7 +162,7 @@ Numbers
Python distinguishes between integers, floating point numbers, and complex
numbers:
Integers
:class:`numbers.Integral`
.. index:: object: integer
These represent elements from the mathematical set of integers (positive and
@ -214,7 +214,7 @@ Numbers
without causing overflow, will yield the same result in the long integer domain
or when using mixed operands.
Floating point numbers
:class:`numbers.Real` (:class:`float`)
.. index::
object: floating point
pair: floating point; number
@ -229,7 +229,7 @@ Numbers
overhead of using objects in Python, so there is no reason to complicate the
language with two kinds of floating point numbers.
Complex numbers
:class:`numbers.Complex`
.. index::
object: complex
pair: complex; number

View file

@ -801,7 +801,8 @@ were of integer types and the second argument was negative, an exception was
raised).
Raising ``0.0`` to a negative power results in a :exc:`ZeroDivisionError`.
Raising a negative number to a fractional power results in a :exc:`ValueError`.
Raising a negative number to a fractional power results in a :class:`complex`
number. (Since Python 2.6. In earlier versions it raised a :exc:`ValueError`.)
.. _unary: