classification
Title: Doc: power operator (`**`) present for numbers.Complex, not added in numbers.Integral
Type: Stage: resolved
Components: Documentation Versions: Python 3.11
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, miss-islington, roryyorke, terry.reedy
Priority: normal Keywords: patch

Created on 2021-05-08 07:05 by roryyorke, last changed 2021-05-14 23:07 by terry.reedy. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 25986 merged roryyorke, 2021-05-08 09:38
PR 26139 merged miss-islington, 2021-05-14 22:02
PR 26140 merged miss-islington, 2021-05-14 22:02
Messages (5)
msg393240 - (view) Author: Rory Yorke (roryyorke) * Date: 2021-05-08 07:05
Checked at commit 42fcad2, HEAD of main circa 8 May 2021.

cpython/Doc/library/numbers.rst says numbers.Complex subtypes "include the operations [...] ``+``, ``-``, ``*``, ``/``, :func:`abs`, :meth:`conjugate`, ``==``, and ``!=``"

and for numbers.Integral: "Adds abstract methods for ``**`` and"

However, in cpython/Lib/numbers.py, the class Complex has `__pow__` and `__rpow__` methods, which makes sense mathematically.  The numbers.Class docstring is also missing a mention of `**`.

class.Integral does define a three-argument __pow__ for three-argument pow().
msg393694 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-05-14 21:28
Yes, complex ** complex works fine, and "TypeError: pow() 3rd argument not allowed unless all arguments are integers".
msg393697 - (view) Author: miss-islington (miss-islington) Date: 2021-05-14 22:22
New changeset 2e99869f64bbd3c6590cb5ceaf9cf59e63689d63 by Miss Islington (bot) in branch '3.10':
bpo-44072: fix Complex, Integral docs for `**` (GH-25986)
https://github.com/python/cpython/commit/2e99869f64bbd3c6590cb5ceaf9cf59e63689d63
msg393698 - (view) Author: miss-islington (miss-islington) Date: 2021-05-14 22:25
New changeset fa9de0c383581936de3338c8dc6b58c10a6e27b8 by Miss Islington (bot) in branch '3.9':
bpo-44072: fix Complex, Integral docs for `**` (GH-25986)
https://github.com/python/cpython/commit/fa9de0c383581936de3338c8dc6b58c10a6e27b8
msg393701 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-05-14 23:07
Thanks for the report and clean patch.
History
Date User Action Args
2021-05-14 23:07:54terry.reedysetstatus: open -> closed
resolution: fixed
messages: + msg393701

stage: patch review -> resolved
2021-05-14 22:25:46miss-islingtonsetmessages: + msg393698
2021-05-14 22:22:52miss-islingtonsetmessages: + msg393697
2021-05-14 22:02:09miss-islingtonsetpull_requests: + pull_request24774
2021-05-14 22:02:04miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request24773
2021-05-14 21:28:12terry.reedysetnosy: + terry.reedy
messages: + msg393694
2021-05-08 09:38:37roryyorkesetkeywords: + patch
stage: patch review
pull_requests: + pull_request24638
2021-05-08 07:05:20roryyorkecreate