We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
foo: str if isinstance(foo, str): ... else: asdf: list[str] = "" # no error
https://mypy-play.net/?mypy=master&python=3.10&gist=98cc704dbc9936fa1c3801984cd631fd
my use case is an assert_unreachable function:
assert_unreachable
def assert_unreachable(msg: str): raise AssertionError(msg) foo: str if isinstance(foo, str): ... else: # no error even though the msg argument was not provided assert_unreachable() #type:ignore[unreachable]
The text was updated successfully, but these errors were encountered:
Yeah, this is intentional. https://mypy.readthedocs.io/en/stable/common_issues.html#unreachable-code I think in practice basically all warnings mypy would give if it didn't do this would end up being false positives.
Sorry, something went wrong.
@hauntsaninja Those docs don't really explain why "this would end up being false positives", only showing very obvious true positives being ignored.
No branches or pull requests
https://mypy-play.net/?mypy=master&python=3.10&gist=98cc704dbc9936fa1c3801984cd631fd
my use case is an
assert_unreachable
function:The text was updated successfully, but these errors were encountered: