Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Improve documentation for annotating generator functions - #11623

Merged
hauntsaninja merged 5 commits into
python:masterfrom
AlexWaygood:patch-1
Nov 27, 2021
Merged

Improve documentation for annotating generator functions#11623
hauntsaninja merged 5 commits into
python:masterfrom
AlexWaygood:patch-1

Conversation

@AlexWaygood

@AlexWaygood AlexWaygood commented Nov 26, 2021

Copy link
Copy Markdown
Member

The mypy documentation is currently ambivalent on whether Iterator or Iterable is the better return-type annotation for a simple generator function. The documentation should endorse using Iterator instead of Iterable, in my opinion, as it is a more precise return type, and no less concise.

The mypy documentation is currently ambivalent on whether ``Iterator`` or ``Iterable`` is the better return-type annotation for a simple generator function. The documentation should endorse using ``Iterator`` instead of ``Iterable`, in my opinion, as it is a more precise return type, and no less concise.

@sobolevn sobolevn left a comment

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.

Thanks, one question from me 🙂

Related python/cpython#29170

Comment thread docs/source/kinds_of_types.rst
@AlexWaygood
AlexWaygood marked this pull request as draft November 26, 2021 11:17
@AlexWaygood
AlexWaygood marked this pull request as ready for review November 26, 2021 14:13
@AlexWaygood

Copy link
Copy Markdown
Member Author

@sobolevn, thoughts on the PR now? 🙂

@sobolevn sobolevn left a comment

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.

LGTM! 👍
Thank you!

Comment thread docs/source/kinds_of_types.rst Outdated
Comment thread docs/source/kinds_of_types.rst Outdated
Comment thread docs/source/kinds_of_types.rst Outdated
@hauntsaninja
hauntsaninja merged commit ca00633 into python:master Nov 27, 2021
@hauntsaninja

Copy link
Copy Markdown
Collaborator

Thank you!

@AlexWaygood

Copy link
Copy Markdown
Member Author

Thank you!

Thanks for the reviews!

@AlexWaygood
AlexWaygood deleted the patch-1 branch November 27, 2021 00:01
tushar-deepsource pushed a commit to DeepSourceCorp/mypy that referenced this pull request Jan 20, 2022
The mypy documentation is currently ambivalent on whether ``Iterator`` or ``Iterable`` is the better return-type annotation for a simple generator function. The documentation should endorse using ``Iterator`` instead of ``Iterable`, in my opinion, as it is a more precise return type, and no less concise.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants