-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
"Missing return statement" for generators that implicitly return None #13019
Comments
This is the same behavior as for non-generator functions, so we're being consistent. See #7511 (and I think there was another issue more recently where people complained about this). |
Ah, I didn't know this. Is there any way to get confirmation on that issue that this is working as intended? Should that go via a discussion topic or |
It's working as intended in mypy. But I don't think the general type system requires it, and other type checkers may make a different decision. And of course, we could change our mind. |
I mean, the added return statement wouldn't make any of the other checkers complain so it isn't that big of an issue. We'll probably need to update |
Bug Report
mypy
complains aboutMissing return statement [return]
on L3. This can be satisfied with areturn None
on L6 after the for loop. However, since the return type of the generator isNone
that shouldn't really be necessary. Like for simpler functions the return ofNone
should be implicit.To Reproduce
Run
mypy
on code above.Expected Behavior
No warning.
Your Environment
mypy 0.961 (compiled: no)
onmacOS
.Python version is 3.11.0b3 but this occurs on other versions as well.
The text was updated successfully, but these errors were encountered: