-
Notifications
You must be signed in to change notification settings - Fork 169
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
rewrite Generator[..., None, None] to Iterator[...] #4
Comments
Note that these aren't fully equivalent. Generators have a |
Hmm, good point. Perhaps that ought to be mentioned at http://mypy.readthedocs.io/en/latest/kinds_of_types.html#generators ? In practice (at least in our codebase) I find the |
Yeah, that's fine. I was just sensitized to the difference by
python/typeshed#1806 (where the key point was
that the docs promised a generator so the close() call should be allowed).
Can you submit a PR for the mypy docs?
|
Done: python/mypy#4424 |
Hey @carljm, I want to work on this issue. I have gone through the source code and saw a make_generator function. Is my job to change the return value from Generator[..] to Iterator[..]? Thank you as you reply |
Hi @iyanuashiri! Thanks for your interest. We could implement this feature by returning |
I think I understand what you want me to do. So I should create a class that inherits from |
Yes, that’s right! |
Hey @carljm, I am sorry it is taking long to send a pull request. I just got a hang of your code and how to implement my solution. Initially I understood what to do but I didn't know how to do it. I will send a PR as soon as possible. Thank you for the patience. |
@carljm I'm confused by the naming convention. Wouldn't we want to name the new method something like rewrite_Generator because the rewrite method in TypeRewriter class will delegate to getattr(typ, 'name', None). |
@kevinjqliu Yes, you're right, that was just me mis-remembering the API. I meant |
No description provided.
The text was updated successfully, but these errors were encountered: