Description
Documentation
(UPDATE: Added multiple suspected errors in code snippets in the documentation and another typo to this initial report in #156233 (comment) as I was OK'd to open a PR but encouraged to expand the scope before sending a fix.)
Hello Python team,
this is just a typo so I know an issue is not required, but I hope you won't mind if I open one in case someone else wants to include it in a larger typo cleanup PR they are already doing (if no one picks it up after some time and I don't find other typos, I can send a PR).
In the latest version of https://docs.python.org/3/howto/mro.html#python-2-3-mro (archived as is at https://web.archive.org/web/20260822145356/https://docs.python.org/3/howto/mro.html#python-2-3-mro )
-
In the sentence
Then repeat the operation until all the class are removed or it is impossible to find good heads.
it seems "all the class" should be "all the classes".
Thanks so much!
Linked PRs
- gh-156233: Fix grammar in MRO documentation #156320
- gh-156233: Fixing a couple of typos and a few code snippet errors in Python docs #156475
- gh-156233: Fix grammar in MRO documentation #157177
- [3.14] gh-156233: Fix typos and code snippet errors in the docs (GH-156475) #157221
- [3.13] gh-156233: Fix typos and code snippet errors in the docs (GH-156475) #157222
- [3.15] gh-156233: Fix typos and code snippet errors in the docs (GH-156475) #157223
- gh-156233: Fix the prior author's 'overly_generic' example's Python SyntaxError, and type annotation errors #157386
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsTodo
Activity
StanFromIreland commentedon Aug 22, 2026
@willy-b would you like to open a PR?
[-]A tiny grammar issue in the Python MRO documentation: "all the class" should be "all the classes"[/-][+]Reporting few typos, grammar mistakes, code snippet errors in the Python documentation (e.g. "speciric" should be "specific" in logging-cookbook; in MRO doc "all the class" should be "all the classes", etc)[/+]willy-b commentedon Aug 27, 2026
Here is another typo and what appear to be a few minor mistakes in some of the code snippet examples in the 3.16 version of the Python documentation (I confirmed the latest code does not have these fixed yet).
On https://docs.python.org/3.16/howto/logging-cookbook.html (archived as is at https://web.archive.org/web/20260827054643/https://docs.python.org/3.16/howto/logging-cookbook.html )
In the sentence
cpython/Doc/howto/logging-cookbook.rst
Line 3923 in fe3a26f
"speciric" should be "specific".
On https://docs.python.org/3.16/library/logging.config.html (archived as is at https://web.archive.org/web/20260827041728/https://docs.python.org/3.16/library/logging.config.html )
It seems the key "." is missing a ":" before its value to avoid
':' expected after dictionary key (<string>, line 6)'for the above.cpython/Doc/library/logging.config.rst
Line 558 in fe3a26f
On https://docs.python.org/3.16/library/pdb.html#pdbcommand-exceptions (archived as is at https://web.archive.org/web/20260827042203/https://docs.python.org/3.16/library/pdb.html#pdbcommand-exceptions )
nit: In the example
There is an extra space on the beginning of the last line
out(), which prevents the snippet from running exactly as is if copy-pasted.cpython/Doc/library/pdb.rst
Line 837 in fe3a26f
On https://docs.python.org/3.16/reference/compound_stmts.html (archived as is at https://web.archive.org/web/20260827044953/https://docs.python.org/3.16/reference/compound_stmts.html )
In the example
(noting one must add
passto the end of the above instead of...before attempting to execute it, but I quoted it as it is)it seems the arguments are possibly in a disallowed order, as I observe the error
non-default type parameter 'TypeVarWithBound' follows default type parameter,cpython/Doc/reference/compound_stmts.rst
Line 1852 in fe3a26f
Thanks so much!
[-]Reporting few typos, grammar mistakes, code snippet errors in the Python documentation (e.g. "speciric" should be "specific" in logging-cookbook; in MRO doc "all the class" should be "all the classes", etc)[/-][+]Reporting a few typos, grammar mistakes, code snippet errors in the Python documentation (e.g. "speciric" should be "specific" in logging-cookbook; in MRO doc "all the class" should be "all the classes", etc)[/+]StanFromIreland commentedon Aug 27, 2026
You can open a PR with all of them.
[-]Reporting a few typos, grammar mistakes, code snippet errors in the Python documentation (e.g. "speciric" should be "specific" in logging-cookbook; in MRO doc "all the class" should be "all the classes", etc)[/-][+]A few typos, grammar mistakes, and code snippet errors in the docs[/+]willy-b commentedon Aug 27, 2026
Note earlier this AM I sent #156475 (which has been partially approved, thanks(!), but is not merged yet) to fix most of the items I reported here.
Note that I did NOT make any updates in that PR to try to fix the
non-default type parameter 'TypeVarWithBound' follows default type parameterfor theoverly_genericexample on https://docs.python.org/3.16/reference/compound_stmts.html yet ( caused bycpython/Doc/reference/compound_stmts.rst
Line 1852 in fe3a26f
willy-b commentedon Aug 29, 2026
Investigating the
overly_genericexample above has led me to file at least one ticket (the mypy tool itself crashed on a related example and instructed me to file a ticket), python/mypy#21907 with mypy which there is a PR out for (thanks to the mypy team and community!).MAYANKSHARMA01010 commentedon Sep 9, 2026
@StanFromIreland @willy-b is this issue still active
willy-b commentedon Sep 9, 2026
@MAYANKSHARMA01010 yes waiting for go, no go on proposed fix to a tutorial in comment #156475 (comment) from @StanFromIreland
5 remaining items
Merge branch 'main' into tachyon-native-callable
willy-b commentedon Sep 10, 2026
@encukou thanks, but it seems inconsistent with other parts of the Python documentation as well
(e.g. ParamSpec is mentioned as able to be substituted with a square bracket list (not parenthesis tuple) in Python side documentation at
cpython/Doc/library/typing.rst
Line 674 in 092c896
error: The default argument to ParamSpec must be a list expression, ellipsis, or a ParamSpec)the ParamSpec is shown substituted by a tuple, by the prior author
cpython/Doc/reference/compound_stmts.rst
Line 1856 in fe3a26f
so especially now that the other PR #156475 for the easier parts of this ticket landed, why not fix the
overly_genericexample for MyPy as well?Here is my proposal (I had posted in it in the previous PR where we decided to separate it out, but it should also be in this issue):
For the
overly_genericexample (which is not supposed to intentionally fail the type checker), after fixing the Python SyntaxError due to bad type parameter ordering, we can address each MyPy-side complaint as follows:To fix:
how about we use
**SimpleParamSpec=[str, bytearray]with square brackets instead of parentheses used by the prior authorcpython/Doc/reference/compound_stmts.rst
Line 1856 in fe3a26f
And to avoid
we can unpack the TypeVarTuple as
*tuple[int, float](using*orUnpack[...]) instead ofcpython/Doc/reference/compound_stmts.rst
Line 1855 in fe3a26f
unpack it also at
cpython/Doc/reference/compound_stmts.rst
Line 1862 in fe3a26f
With both those changes as well as moving
TypeVarWithDefaultafter the type arguments without defaults (the SyntaxError by the article author), see below:Some related checks we can do in MyPy are:
What do you think? Thanks!
encukou commentedon Sep 11, 2026
(Docs for the
typingmodule are specifically for static typing; there I'd expect type checkers to pass.)Anyway, your suggestion looks good, do you want to turn it into a PR?
Consider also matching the arguments to the type examples one-to-one:
pythongh-156233: Fix typos and code snippet errors in the docs (pytho…
willy-b commentedon Sep 13, 2026
Thanks @encukou I sent #157386 , let me know what you think! To make a minimal change fixing the Python SyntaxError and the MyPy type annotation errors I did not change the Callable's return type but left the use of the constrained generic type as is in the PR as that part of the original author's vision can be preserved.
pythongh-156233: Fix typos and code snippet errors in the docs (pytho…
willy-b commentedon Oct 10, 2026
FYI @encukou the crash I had found in MyPy (official type checker) related to cases similar to those in the
overly_genericdocumentation example was resolved in python/mypy#21907 by that team (I had essentially the same approach in my fork and discussion in issue but happy the team did the PR there as did not want to create side effects and I don't claim team-level knowledge of that code).However, the PR to update the documentation as we discussed remains at #157386 (pending review; now safer as the MyPy bug one might encounter exploring it has been resolved). Let me know if you have any feedback (no pressure, no rush!). Thanks!
Rafiaminhaj commentedon Oct 13, 2026
Hi! I'm Rafia Minhaj, a final-year B.Tech CSE student with experience in Python, FastAPI, and open source contributions (GSSoC 2026 Top 1%, Hacktoberfest 2026). I would love to work on this issue and help fix the typos, grammar mistakes, and code snippet errors in the docs. Could you please let me know if this issue is still available? I'll get started right away. Thank you!??
willy-b commentedon Oct 13, 2026
@Rafiaminhaj you can help review the PR already available for this #157386
and/or you can give me your email and I can share these items I spend time to find with you (as in this ticket or e.g. a different batch I sent up a fix for in #157879 , also pending review ) in advance of posting them to see if you want them. In that case I could either post them with you mentioned as working on it or you could work on it in advance and just send your fixes.
Rafiaminhaj commentedon Oct 13, 2026
Hi @willy-b
Thank you for the opportunity! I'd be happy to help review PR #157386 and contribute to the CPython documentation improvements.
I'll go through the changes carefully and share my feedback. I'd also be glad to work on the additional documentation issues you mentioned.
Thanks again for your guidance!
Shalini-07-M commentedon Oct 19, 2026
Hi! I'm a beginner interested in making my first contribution to CPython. I'd be happy to help fix a small documentation typo or error. Could you suggest one of the additional documentation issues that hasn't been claimed yet? Thank you!
willy-b commentedon Oct 22, 2026
@Shalini-07-M I am no gatekeeper, per the Python documentation anyone can send PRs to fix documentation typos, see
cpython/Doc/improve-page.rst
Line 43 in c1c4c18
cpython/Doc/improve-page.rst
Line 64 in c1c4c18
and
cpython/.github/ISSUE_TEMPLATE/documentation.yml
Line 9 in c1c4c18
for example.
However, if you give me your contact info then when I find some more I can send some to you that you can send a patch for, if that helps you get started. It can take a lot of reading or searching to find typos or potential items to fix (spending lots of time reading documentation is of course advised in any case), and I would be happy to give you a boost if I can.
Thanks!