Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Doc/library/numbers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ The numeric tower
Subclasses of this type describe complex numbers and include the operations
that work on the built-in :class:`complex` type. These are: conversions to
:class:`complex` and :class:`bool`, :attr:`.real`, :attr:`.imag`, ``+``,
``-``, ``*``, ``/``, :func:`abs`, :meth:`conjugate`, ``==``, and ``!=``. All
except ``-`` and ``!=`` are abstract.
``-``, ``*``, ``/``, ``**``, :func:`abs`, :meth:`conjugate`, ``==``, and
``!=``. All except ``-`` and ``!=`` are abstract.

.. attribute:: real

Expand Down Expand Up @@ -76,8 +76,9 @@ The numeric tower

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


Notes for type implementors
Expand Down
8 changes: 6 additions & 2 deletions Lib/numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Complex(Number):
"""Complex defines the operations that work on the builtin complex type.

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
knowledge about them, it should fall back to the builtin complex
Expand Down Expand Up @@ -292,7 +292,11 @@ def __float__(self):


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__ = ()

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