|
| 1 | +--- |
| 2 | +title: "Improve syntax documentation" |
| 3 | +date: "2026-11-10" |
| 4 | +status: "active" |
| 5 | +sponsor: "" |
| 6 | +lead: "Petr Viktorin" |
| 7 | +summary: "Reword the syntax chapters of the Python Language Reference to match current Python: an overview and common uses first, then increasingly complex details, ending with the formal grammar." |
| 8 | +project_issue: "https://github.com/python/editorial-board/issues/48" |
| 9 | +weight: 10 |
| 10 | +links: |
| 11 | + - url: "https://github.com/python/cpython/issues/135676" |
| 12 | + - url: "https://github.com/python/cpython/issues/141984" |
| 13 | + - title: "Python Language Reference" |
| 14 | + url: "https://docs.python.org/3/reference/index.html" |
| 15 | +--- |
| 16 | + |
| 17 | +## Description |
| 18 | + |
| 19 | +1. Reword each section of the syntax chapters of the |
| 20 | + [Python Language Reference](https://docs.python.org/3/reference/index.html): |
| 21 | + - [x] Lexical analysis |
| 22 | + - [ ] Expressions |
| 23 | + - [ ] Simple statements |
| 24 | + - [ ] Compound statements |
| 25 | + - [ ] Top-level components |
| 26 | +2. Synchronize the documented formal grammar with Python's actual grammar. |
| 27 | + (Both will need changing.) |
| 28 | +3. Automatically generate as much of the formal grammar snippets as possible. |
| 29 | +4. Add railroad diagrams to the docs. |
| 30 | +5. Move the non-syntax chapters (Data model, Execution model, The import |
| 31 | + system) out of the Language Reference, and possibly rename it to |
| 32 | + *Python Syntax Reference*. |
| 33 | + |
| 34 | +## Benefits |
| 35 | + |
| 36 | +Better syntax docs that match current Python. |
| 37 | + |
| 38 | +## Decisions |
| 39 | + |
| 40 | +- Is this a good direction? |
| 41 | +- Is the style good? See the mostly finished |
| 42 | + [Lexical analysis](https://docs.python.org/3/reference/lexical_analysis.html) |
| 43 | + chapter and the [current work](https://github.com/python/cpython/issues/141984) |
| 44 | + on Expressions. |
| 45 | + |
| 46 | +## Challenges and risks |
| 47 | + |
| 48 | +- There is an abrupt change in style between the rewritten chapters and the |
| 49 | + rest that is still untouched. |
| 50 | +- The work is moving slowly, and depends on one person. |
| 51 | + |
| 52 | +## How to help |
| 53 | + |
| 54 | +To help, you can review open pull requests (linked to |
| 55 | +[issue #141984](https://github.com/python/cpython/issues/141984)), |
| 56 | +and/or join weekly livestreams at the |
| 57 | +[Python Docs Discord](https://discord.gg/ED65xD8WRg). |
| 58 | + |
| 59 | +The lead is not looking for people to take this on, since reviewing would be |
| 60 | +as hard as writing. Feedback on the direction and style is welcome. The work |
| 61 | +happens on weekly livestreams. |
0 commit comments