You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"# type: ignore" does not seem to work on multiline dicts #627
Thanks for reporting this! I think the reason is that mypy only recognizes ignore annotations on the last line of a statement, which is clearly broken.
I think that there are also some other cases where # type: ignore might not work correctly. The feature is still going to need a bit more love :-) If you spot any other cases where it behaves strangely, please report them since this is a pretty important feature.
The # type: ignore comment should be put on the line that the error refers to. This way we can only ignore parts of a multi-line statement, which can be useful in cases such as large dict literals.
Activity
JukkaL commentedon Mar 31, 2015
Thanks for reporting this! I think the reason is that mypy only recognizes ignore annotations on the last line of a statement, which is clearly broken.
I think that there are also some other cases where
# type: ignoremight not work correctly. The feature is still going to need a bit more love :-) If you spot any other cases where it behaves strangely, please report them since this is a pretty important feature.JukkaL commentedon Apr 5, 2015
Your example should now work like this:
The
# type: ignorecomment should be put on the line that the error refers to. This way we can only ignore parts of a multi-line statement, which can be useful in cases such as large dict literals.gvanrossum commentedon Apr 6, 2015
Do you think we should specify this in the PEP? Or is this a mypy "extra"?