KEMBAR78
Improve documentation for annotating generator functions by AlexWaygood · Pull Request #11623 · python/mypy · GitHub
Skip to content

Conversation

@AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Nov 26, 2021

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.
Copy link
Member

@sobolevn sobolevn left a comment

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

@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
Member Author

@sobolevn, thoughts on the PR now? 🙂

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

LGTM! 👍
Thank you!

@hauntsaninja hauntsaninja merged commit ca00633 into python:master Nov 27, 2021
@hauntsaninja
Copy link
Collaborator

Thank you!

@AlexWaygood
Copy link
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.

3 participants