Skip to content

gh-141984: Reword the "yield expressions"` section - #159421

Open
encukou wants to merge 12 commits into
python:mainfrom
encukou:expressions-yield-2
Open

encukou wants to merge 12 commits into
python:mainfrom
encukou:expressions-yield-2

Conversation

@encukou

@encukou encukou commented Oct 14, 2026 •

Copy link
Copy Markdown
Member
  • Move discussion on the runtime behaviour of generators to builtins/stdtypes.rst.
  • Reword and expand the section on yield expressions: start with an overview and common usage, then add details, end with formal grammar and examples.
  • De-emphasize using yield to implement coroutines (the use case is now served by async/await.
  • Copy an example from PEP-380 to keep the docs more self-contained
  • In Simple Statements, merge yield_stmt into expression_stmt

This PR stops before the section on async generators (yield in async functions); that's left for the next PR.

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #35146121 | 📁 Comparing 8ae0306 against main (2588362)

  🔍 Preview build  

5 files changed · ± 5 modified

± Modified

@encukou

encukou commented Oct 14, 2026

Copy link
Copy Markdown
Member Author

(I'll fix the lint issues later; hopefully they won't block review.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant