Repository navigation
Keep yields apart from returns - #156
Merged
Merged
Conversation
Docstring.returns and many_returns gave yields too, as they share the DocstringReturns class, so a generator's docstring looked like it documented a return value. They now leave out metas of kind YIELDS, which the new yields and many_yields give instead.
This was referenced Nov 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Returns and yields both parse into
DocstringReturns, andDocstring.returnstook the firstDocstringReturnsit found. A generator's docstring then looked like it documented a return value:returnsandmany_returnsnow leave out metas whosekindisKind.YIELDS. The newyieldsandmany_yieldsgive those instead. The class staysDocstringReturnsandis_generatorstays, so code that reads yields throughmetakeeps working.This is breaking for users who read yields through
returns. They need to switch toyields. pydoclint's fork hasyieldsandmany_yieldsunder these names, so code written against the fork works with this.Parse output does not change, so parity is 0 of 29,074. The change is only in what the two properties return. A yield shows up in some style for 9 case inputs, 4 stdlib docstrings and 2,454 generated ones, and those are the docstrings where
returnscan now give something else.Bench on 3.8: 0.99–1.03x of main.