8000 gh-100201: Document behavior with a bare yield statement by ramvikrams · Pull Request #100416 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-100201: Document behavior with a bare yield statement #100416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 1, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Doc/reference/expressions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,10 @@ generator. That generator then controls the execution of the generator
function. The execution starts when one of the generator's methods is called.
At that time, the execution proceeds to the first yield expression, where it is
suspended again, returning the value of :token:`~python-grammar:expression_list`
to the generator's caller. By suspended, we mean that all local state is
retained, including the current bindings of local variables, the instruction
pointer, the internal evaluation stack, and the state of any exception handling.
to the generator's caller, but returns :const:`None` when the optional
:token:`~python-grammer:expression_list` is not passed. By suspended, we mean that
all local state is retained, including the current bindings of local variables, the
instruction pointer, the internal evaluation stack, and the state of any exception handling.
When the execution is resumed by calling one of the generator's methods, the
function can proceed exactly as if the yield expression were just another
external call. The value of the yield expression after resuming depends on the
Expand Down
0