bpo-44072: fix Complex, Integral docs for `**` (GH-25986)

In numbers module docstrings and docs.
This commit is contained in:
Rory Yorke 2021-05-15 00:01:48 +02:00 committed by GitHub
parent c10c2ec7a0
commit 4aa63d65a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 6 deletions

View File

@ -27,8 +27,8 @@ The numeric tower
Subclasses of this type describe complex numbers and include the operations Subclasses of this type describe complex numbers and include the operations
that work on the built-in :class:`complex` type. These are: conversions to that work on the built-in :class:`complex` type. These are: conversions to
:class:`complex` and :class:`bool`, :attr:`.real`, :attr:`.imag`, ``+``, :class:`complex` and :class:`bool`, :attr:`.real`, :attr:`.imag`, ``+``,
``-``, ``*``, ``/``, :func:`abs`, :meth:`conjugate`, ``==``, and ``!=``. All ``-``, ``*``, ``/``, ``**``, :func:`abs`, :meth:`conjugate`, ``==``, and
except ``-`` and ``!=`` are abstract. ``!=``. All except ``-`` and ``!=`` are abstract.
.. attribute:: real .. attribute:: real
@ -76,8 +76,9 @@ The numeric tower
Subtypes :class:`Rational` and adds a conversion to :class:`int`. Provides Subtypes :class:`Rational` and adds a conversion to :class:`int`. Provides
defaults for :func:`float`, :attr:`~Rational.numerator`, and defaults for :func:`float`, :attr:`~Rational.numerator`, and
:attr:`~Rational.denominator`. Adds abstract methods for ``**`` and :attr:`~Rational.denominator`. Adds abstract methods for :func:`pow` with
bit-string operations: ``<<``, ``>>``, ``&``, ``^``, ``|``, ``~``. modulus and bit-string operations: ``<<``, ``>>``, ``&``, ``^``, ``|``,
``~``.
Notes for type implementors Notes for type implementors

View File

@ -33,7 +33,7 @@ class Complex(Number):
"""Complex defines the operations that work on the builtin complex type. """Complex defines the operations that work on the builtin complex type.
In short, those are: a conversion to complex, .real, .imag, +, -, In short, those are: a conversion to complex, .real, .imag, +, -,
*, /, abs(), .conjugate, ==, and !=. *, /, **, abs(), .conjugate, ==, and !=.
If it is given heterogeneous arguments, and doesn't have special If it is given heterogeneous arguments, and doesn't have special
knowledge about them, it should fall back to the builtin complex knowledge about them, it should fall back to the builtin complex
@ -292,7 +292,11 @@ def __float__(self):
class Integral(Rational): class Integral(Rational):
"""Integral adds a conversion to int and the bit-string operations.""" """Integral adds methods that work on integral numbers.
In short, these are conversion to int, pow with modulus, and the
bit-string operations.
"""
__slots__ = () __slots__ = ()

View File

@ -0,0 +1,2 @@
Correct where in the numeric ABC hierarchy ``**`` support is added, i.e., in
numbers.Complex, not numbers.Integral.