-
-
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
Update documentation on --warn-no-return and NoReturn #2920
Conversation
docs/source/kinds_of_types.rst
Outdated
The NoReturn type | ||
***************** | ||
|
||
Mypy also provides an experimental support for functions that supposed to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that are supposed
Also, I think you should remove "an" in "an experimental support".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the support is not considered experimental.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the support is not considered experimental.
But why then NoReturn
is in mypy_extensions
? Maybe it should be moved to typing
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be reasonable to discuss adding NoReturn
to typing
in the typing issue tracker. Features in mypy_extensions
are non-standard, and they may be experimental but aren't necessarily.
docs/source/kinds_of_types.rst
Outdated
def stop() -> NoReturn: | ||
raise Exception('no way') | ||
|
||
Mypy will recognize that the code after such function is unreachable and will |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"such functions" or "such a function"
docs/source/kinds_of_types.rst
Outdated
stop() | ||
return 'whatever works' # No error in an unreachable block | ||
|
||
Note that ``NoReturn`` annotation is different from just not returning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a run-on sentence and "Note that" doesn't add anything. Maybe rewrite this as "Annotating a function with NoReturn
is different from just not returning a value from a function. In the latter case, None
is returned implicitly."
Thanks! Made a few tweaks. Will merge once the tests pass. |
Fixes #2919
Fixes #2918