Yes, mypy supports "# type: ignore[x, y, z]", but that's a problem for code bases that are using multiple type checkers.
PEP 484 documents "# type: ignore", but it says nothing about what comes after the comment. Mypy chose to support a non-standard extension where it modifies the behavior of "# type: ignore" if it is followed by a group of mypy-specific diagnostic names enclosed in square brackets. Other type checkers like pyright treat "# type: ignore" as it is documented in PEP 484 regardless of what comes after it.
Developers who want to run both mypy and other type checkers on their code need a way to specify "mypy should ignore these issues", "pyright should ignore these issues", etc. Mypy currently provides no way to do this. Pyright provides a pyright-specific "# pyright: ignore[x, y, z]". It would be good for mypy and other type checkers to do the same. But supporting this is difficult for mypy because it relies on the Python parser, which has intimate knowledge of "# type: ignore" comments.
-Eric
_______________________________________________
Typing-sig mailing list -- typing-sig@python.org
To unsubscribe send an email to typing-sig-leave@python.org
https://mail.python.org/mailman3/lists/typing-sig.python.org/
Member address: guido@python.org