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

Update documentation on --warn-no-return and NoReturn #2920

Merged
merged 4 commits into from
Feb 28, 2017

Conversation

ilevkivskyi
Copy link
Member

Fixes #2919
Fixes #2918

@ilevkivskyi ilevkivskyi mentioned this pull request Feb 27, 2017
The NoReturn type
*****************

Mypy also provides an experimental support for functions that supposed to
Copy link
Member

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".

Copy link
Collaborator

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.

Copy link
Member Author

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?

Copy link
Collaborator

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.

def stop() -> NoReturn:
raise Exception('no way')

Mypy will recognize that the code after such function is unreachable and will
Copy link
Member

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"

stop()
return 'whatever works' # No error in an unreachable block

Note that ``NoReturn`` annotation is different from just not returning
Copy link
Member

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."

@ddfisher
Copy link
Collaborator

Thanks! Made a few tweaks. Will merge once the tests pass.

@ddfisher ddfisher merged commit 3675be7 into python:master Feb 28, 2017
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

Successfully merging this pull request may close these issues.

4 participants