-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Make the 2 last parameters for typing.Generator optional #4221
Comments
This issue is probably better suited to be discussed in the typing repo https://github.com/python/typing |
Is there a reason you can't use |
Because the type is a Generator. Are we annotating the types or not? |
We are annotating the types, all three of them, yield send and return ;-) For everything else, there's Iterator. While I don't think this is a compelling case since there's a solution that works perfectly well, I'm sympathetic to the idea of defaults for generic types in general. The forum to take that issue up is the typing-sig mailing list or https://github.com/python/typing, not here |
If I use:
mypy complains:
I can silence mypy by doing:
But given that the majority of generators just yield, rarely return or send, I think it would make sense to allow the last 2 parameters to have a default value of None.
The text was updated successfully, but these errors were encountered: