Skip to content
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

Review DOC404 / DOC405 (Generator vs Iterator) #76

Closed
llucax opened this issue Aug 24, 2023 · 3 comments
Closed

Review DOC404 / DOC405 (Generator vs Iterator) #76

llucax opened this issue Aug 24, 2023 · 3 comments

Comments

@llucax
Copy link
Contributor

llucax commented Aug 24, 2023

The rule imposed by DOC404/DOC405, including the justification in Notes on Generator vs Iterator doesn't go in line with Python's official documentation, which explicitly says Iterator and AsyncIterator can be used as return types for functions that yield (even more, the documentation say that also Iterable/AsyncIterable can be used).

Having this (artificial) restriction in pydoclint only makes users have to write more pedantic code, which is also harder to read for the casual reader (what are all the None in Generator?), when the shorter form is supported by Python and type-checkers like mypy and pyright.

image

image

@llucax llucax changed the title Review DOC405 (Generator vs Iterator) Review DOC404 / DOC405 (Generator vs Iterator) Aug 24, 2023
@jsh9
Copy link
Owner

jsh9 commented Aug 28, 2023

Hi @llucax , you convinced me.

I implemented #77 to stop enforcing people to use Generators.

And to address the corner case where a function both yields and returns stuff, I implemented #78, as well as 3 other PRs from another library:

Please try out version 0.3.0 (or above). If you find any issues, please don't hesitate to leave other comments!

@llucax
Copy link
Contributor Author

llucax commented Aug 28, 2023

Thanks @jsh9, I really appreciate it! We are finally switching all our projects to pydoclint ❤️

@jsh9
Copy link
Owner

jsh9 commented Aug 29, 2023

Glad to hear that! Thank you for making all these suggestions and providing me test cases!

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

No branches or pull requests

2 participants