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.
Typing-sig mailing list -- email@example.com
To unsubscribe send an email to firstname.lastname@example.org
Member address: email@example.com