Skip to content

gh-141984: Move generator iterator reference out of syntax docs - #154884

Open
encukou wants to merge 10 commits into
python:mainfrom
encukou:move-generator-iterator-out
Open

gh-141984: Move generator iterator reference out of syntax docs#154884
encukou wants to merge 10 commits into
python:mainfrom
encukou:move-generator-iterator-out

Conversation

@encukou

@encukou encukou commented Jul 29, 2026

Copy link
Copy Markdown
Member

The Expressions section of the docs contains reference documentation (that is, descriptions of all the methods) for Generator-iterators and Asynchronous generator-iterators.
These look out of place here, and interfere with explaining the syntax around yield.

There are two places that would make a better home for these: stdtypes in Library and datamodel in Reference. (These two have a lot of overlap, for what I think are mostly historical reasons, but fixing that is out of scope for this PR.)
I think stdtypes is the better place to put these.

I added an introduction to Generators here, which currently overlaps a bit with the Yield expressions in the grammar docs. I'll be reworking Yield expressions next.

@read-the-docs-community

read-the-docs-community Bot commented Jul 29, 2026

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #34257695 | 📁 Comparing 7b3ac38 against main (bfc16a7)

  🔍 Preview build  

98 files changed · + 1 added · ± 97 modified

+ Added

± Modified

Comment thread Doc/library/stdtypes.rst
methods.
More information about generators can be found in :ref:`the documentation for
the yield expression <yieldexpr>`.
Python's :term:`generators <generator>` -- or more precisely,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This unfortunately isn't helping #126052.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but before that's solved, this is the place to put the info.

Comment thread Doc/library/stdtypes.rst Outdated
For example::

>>> class CardDeck:
... def __iter__(self):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation.

Comment thread Doc/library/stdtypes.rst Outdated
Comment thread Doc/library/stdtypes.rst Outdated
Comment thread Doc/library/stdtypes.rst
Asynchronous generator-iterators
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This subsection describes the methods of an asynchronous generator iterator,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An expanded introduction would be nice here, too. Although that can be done in a follow up.

Comment thread Doc/library/stdtypes.rst Outdated
Comment thread Doc/library/stdtypes.rst Outdated
Comment thread Doc/library/stdtypes.rst Outdated
Comment thread Doc/tools/removed-ids.txt
using/windows.html: virtual-environments
using/windows.html: windows-full

# Moved to library/stdtypes:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These unfortunately do seem like things people would link to (in fact, they do), it would be nice to preserve these (possibly via #151113).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think of removed-ids.txt as a TODO list.

@StanFromIreland StanFromIreland Aug 26, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think of removed-ids.txt as a TODO list.

I see. I'm worried we're effectively postponing this ad Kalendas Graecas. The list is quite long now, and people are already using these links. Doing it later makes less sense, as it will be more daunting to tackle at once (rather than incrementally), and by then most will have updated to the new location and the pain will have passed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(What does "ad Kalendas Graecas" mean?)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Ad Calendas Graecas (to the Greek Kalends) is a little old joke that means “never,” because the Kalends were the first day of each month in the Roman calendar, while the Greek calendar had no Kalends.)

Comment thread Doc/library/stdtypes.rst Outdated
Comment thread Doc/library/stdtypes.rst Outdated
Comment thread Doc/tools/removed-ids.txt
using/windows.html: virtual-environments
using/windows.html: windows-full

# Moved to library/stdtypes:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(What does "ad Kalendas Graecas" mean?)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting merge docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants