Skip to content

Commit 4aa63d6

Browse files
authored
bpo-44072: fix Complex, Integral docs for ** (pythonGH-25986)
In numbers module docstrings and docs.
1 parent c10c2ec commit 4aa63d6

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

Doc/library/numbers.rst

+5-4
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ The numeric tower
2727
Subclasses of this type describe complex numbers and include the operations
2828
that work on the built-in :class:`complex` type. These are: conversions to
2929
:class:`complex` and :class:`bool`, :attr:`.real`, :attr:`.imag`, ``+``,
30-
``-``, ``*``, ``/``, :func:`abs`, :meth:`conjugate`, ``==``, and ``!=``. All
31-
except ``-`` and ``!=`` are abstract.
30+
``-``, ``*``, ``/``, ``**``, :func:`abs`, :meth:`conjugate`, ``==``, and
31+
``!=``. All except ``-`` and ``!=`` are abstract.
3232

3333
.. attribute:: real
3434

@@ -76,8 +76,9 @@ The numeric tower
7676

7777
Subtypes :class:`Rational` and adds a conversion to :class:`int`. Provides
7878
defaults for :func:`float`, :attr:`~Rational.numerator`, and
79-
:attr:`~Rational.denominator`. Adds abstract methods for ``**`` and
80-
bit-string operations: ``<<``, ``>>``, ``&``, ``^``, ``|``, ``~``.
79+
:attr:`~Rational.denominator`. Adds abstract methods for :func:`pow` with
80+
modulus and bit-string operations: ``<<``, ``>>``, ``&``, ``^``, ``|``,
81+
``~``.
8182

8283

8384
Notes for type implementors

Lib/numbers.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Complex(Number):
3333
"""Complex defines the operations that work on the builtin complex type.
3434
3535
In short, those are: a conversion to complex, .real, .imag, +, -,
36-
*, /, abs(), .conjugate, ==, and !=.
36+
*, /, **, abs(), .conjugate, ==, and !=.
3737
3838
If it is given heterogeneous arguments, and doesn't have special
3939
knowledge about them, it should fall back to the builtin complex
@@ -292,7 +292,11 @@ def __float__(self):
292292

293293

294294
class Integral(Rational):
295-
"""Integral adds a conversion to int and the bit-string operations."""
295+
"""Integral adds methods that work on integral numbers.
296+
297+
In short, these are conversion to int, pow with modulus, and the
298+
bit-string operations.
299+
"""
296300

297301
__slots__ = ()
298302

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

0 commit comments

Comments
 (0)