This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Use syntactically correct examples on abc package page
Type: behavior Stage: patch review
Components: Documentation Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Vladimir Ryabtsev, corona10, docs@python, miss-islington, sobolevn
Priority: normal Keywords: patch

Created on 2021-04-01 18:18 by Vladimir Ryabtsev, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 30502 merged sobolevn, 2022-01-09 15:21
PR 30917 merged miss-islington, 2022-01-26 10:06
PR 30918 merged miss-islington, 2022-01-26 10:06
Messages (5)
msg390004 - (view) Author: Vladimir Ryabtsev (Vladimir Ryabtsev) * Date: 2021-04-01 18:18
There are code snippets on the package's page (https://docs.python.org/3.10/library/abc.html) like this:

class C(ABC):
    @classmethod
    @abstractmethod
    def my_abstract_classmethod(cls, ...):
        ...

Here, the author probably wanted to demonstrate that the method may have _any other arguments_ in addition to `cls`, but it makes the code not compilable:

    def my_abstract_classmethod(cls, ...):
                                     ^
SyntaxError: invalid syntax

Additionally it uses the same Ellipsis as in the method's body (that is supposed to indicate a stub), which is confusing.

I think that all code samples must be syntactically correct, so that if a reader copypastes them into their code editor they would work right away. I suggest to remove ellipsis in the argument lists everywhere on the page and replace them with one of the following:

- sample parameters such as `a, b, c` or `my_arg1, my_arg2`,
- `*args, **kwargs`,
- nothing.
msg410157 - (view) Author: Nikita Sobolev (sobolevn) * (Python triager) Date: 2022-01-09 15:33
Thank you, I fully agree that this can be improved.

Please, take a look at https://github.com/python/cpython/pull/30502
I will apprecaite your review!
msg411727 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2022-01-26 10:06
New changeset b9d8980d89bfaa4bf16d60f0488adcc9d2cbf5ef by Nikita Sobolev in branch 'main':
bpo-43698: do not use `...` as argument name in docs (GH-30502)
https://github.com/python/cpython/commit/b9d8980d89bfaa4bf16d60f0488adcc9d2cbf5ef
msg411746 - (view) Author: miss-islington (miss-islington) Date: 2022-01-26 12:42
New changeset a57ec7a4feaf24f470a9d1e5b1b3f2cb1b062af7 by Miss Islington (bot) in branch '3.10':
bpo-43698: do not use `...` as argument name in docs (GH-30502)
https://github.com/python/cpython/commit/a57ec7a4feaf24f470a9d1e5b1b3f2cb1b062af7
msg411747 - (view) Author: miss-islington (miss-islington) Date: 2022-01-26 12:42
New changeset 49971b2d1890c15eeec2d83ea3e8d178f266c4f9 by Miss Islington (bot) in branch '3.9':
bpo-43698: do not use `...` as argument name in docs (GH-30502)
https://github.com/python/cpython/commit/49971b2d1890c15eeec2d83ea3e8d178f266c4f9
History
Date User Action Args
2022-04-11 14:59:43adminsetgithub: 87864
2022-01-26 12:42:42miss-islingtonsetmessages: + msg411747
2022-01-26 12:42:29miss-islingtonsetmessages: + msg411746
2022-01-26 10:06:24miss-islingtonsetpull_requests: + pull_request29097
2022-01-26 10:06:19miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request29096
2022-01-26 10:06:16corona10setnosy: + corona10
messages: + msg411727
2022-01-09 21:39:47AlexWaygoodsettype: compile error -> behavior
stage: patch review
2022-01-09 15:33:14sobolevnsetmessages: + msg410157
stage: patch review -> (no value)
2022-01-09 15:21:28sobolevnsetkeywords: + patch
nosy: + sobolevn

pull_requests: + pull_request28708
stage: patch review
2021-04-01 18:18:39Vladimir Ryabtsevcreate