Skip to content

gh-150831: clarify generator, generator function, and generator iterator in glossary#150905

Merged
nedbat merged 8 commits into
python:mainfrom
Aniketsy:fix-150831
Jun 21, 2026
Merged

gh-150831: clarify generator, generator function, and generator iterator in glossary#150905
nedbat merged 8 commits into
python:mainfrom
Aniketsy:fix-150831

Conversation

@Aniketsy

@Aniketsy Aniketsy commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

@read-the-docs-community

read-the-docs-community Bot commented Jun 4, 2026

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33235125 | 📁 Comparing d2b5884 against main (cb064e7)

  🔍 Preview build  

83 files changed · + 1 added · ± 82 modified

+ Added

± Modified

@nedbat

nedbat commented Jun 5, 2026

Copy link
Copy Markdown
Member

I would love to move the glossary closer to actual usage. I have never heard someone say "generator iterator": it's redundant. Can we explicitly mention that "generator" is used informally for both meanings and that "generator function" and "generator iterator" are formal terms that are uncommon?

@Aniketsy

Aniketsy commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

Can we explicitly mention that "generator" is used informally for both meanings and that "generator function" and "generator iterator" are formal terms that are uncommon?

hmm , i think its good to mention like this. thanks for the improvement 😊

Comment thread Doc/glossary.rst Outdated
Comment thread Doc/glossary.rst Outdated
Generator iterators also implement the :meth:`~generator.send` method
to send a value into the suspended generator, and the
:meth:`~generator.throw` method to raise an exception at the point
where the generator was paused. See :pep:`342`.

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.

Let's find a reference in the docs to explain this instead of a PEP.

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.

:ref:`generator-methods`

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thanks for the reference 😊 .

Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
Comment thread Doc/glossary.rst Outdated
@lambda-abstraction

Copy link
Copy Markdown

there is also the asynchronous generator section (which is far away from the generator one because alphabetical sorting a is way before g), that should mirror the changes

Comment thread Doc/glossary.rst Outdated
:term:`asynchronous generator iterator` are uncommon in practice;
"asynchronous generator" alone is almost always sufficient.

An asynchronous generator function may contain :keyword:`await`

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 paragraph should be in the async generator function entry below.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thanks, i've updated this

@Aniketsy

Copy link
Copy Markdown
Contributor Author

@nedbat please let me know, if we need any further improvements. Thanks 😊

@nedbat nedbat merged commit 1de86e1 into python:main Jun 21, 2026
30 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Jun 21, 2026
@nedbat nedbat added the needs backport to 3.13 bugs and security fixes label Jun 21, 2026
@nedbat nedbat added needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Jun 21, 2026
@miss-islington-app

Copy link
Copy Markdown

Thanks @Aniketsy for the PR, and @nedbat for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @Aniketsy for the PR, and @nedbat for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @Aniketsy for the PR, and @nedbat for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Jun 21, 2026

Copy link
Copy Markdown

GH-151839 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jun 21, 2026
@bedevere-app

bedevere-app Bot commented Jun 21, 2026

Copy link
Copy Markdown

GH-151840 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jun 21, 2026
@bedevere-app

bedevere-app Bot commented Jun 21, 2026

Copy link
Copy Markdown

GH-151841 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Jun 21, 2026
nedbat pushed a commit that referenced this pull request Jun 21, 2026
…nerator iterator in glossary (GH-150905) (#151841)

gh-150831: docs: clarify generator, generator function, and generator iterator in glossary (GH-150905)
(cherry picked from commit 1de86e1)

Co-authored-by: Aniket <148300120+Aniketsy@users.noreply.github.com>
nedbat pushed a commit that referenced this pull request Jun 21, 2026
…nerator iterator in glossary (GH-150905) (#151839)

gh-150831: docs: clarify generator, generator function, and generator iterator in glossary (GH-150905)
(cherry picked from commit 1de86e1)

Co-authored-by: Aniket <148300120+Aniketsy@users.noreply.github.com>
nedbat pushed a commit that referenced this pull request Jun 21, 2026
…nerator iterator in glossary (GH-150905) (#151840)

gh-150831: docs: clarify generator, generator function, and generator iterator in glossary (GH-150905)
(cherry picked from commit 1de86e1)

Co-authored-by: Aniket <148300120+Aniketsy@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Glossary terms for generators might mismatch usage in the community and are inconsistent with coroutines

3 participants