-
-
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
documentation for module-level # type: ignore
is unclear
#7839
Comments
The actual implementation is that mypy marks the entire module as unreachable... as if the whole thing were indented inside of an Perhaps modules should grow something like an If we agree that this is the correct path forward, I can work on this. |
Mypy has the # mypy: ignore-errors
x = 1 + '' # No error reported |
Agreed, they're functionally identical. I can take this. |
I am also suffering from this bug; a file marked |
Per-module error codes were added in python#13502, let's recommend using them. The existing type ignore behaviour is pretty unintuitive; I think most people actually want `# mypy: ignore-errors`. There are probably people depending on the current behaviour though. Fixes python#13435, fixes python#12076, fixes python#11999, fixes python#11027, fixes python#9318, fixes python#7839
My expectation of a module-level
# type: ignore
comment is that it will skip typechecking of everything in the module; i.e., everything would be given the typeAny
.The description in the documentation such a comment "has the effect of ignoring the entire module.", is, I think, consistent with that impression, since what "ignoring" means earlier in the documentation has been basically skipping typechecking.
What it actually does, though, seems to be to cause mypy to quite literally ignore the module: it is just skipped entirely, with the result that you can't import names defined in that module in another one:
This makes the feature somewhat less useful IMO, but also, I think it could be clearer in the docs that that's what it does.
The text was updated successfully, but these errors were encountered: