@@ -73,12 +73,24 @@ other comments and linting markers:
7373
7474 # type: ignore # <comment or other marker>
7575
76- Any text following ``# type: ignore `` is ignored, provided there is at least one
77- whitespace character after ``# type: ignore ``. The form of
78- ``# type: ignore[error_code1, error_code2] `` can be used to filter error codes
79- that may vary across type checkers. Type checkers may ignore the bracketed
80- codes and treat this form as equivalent to ``# type: ignore ``.
81-
76+ Text following ``# type: ignore `` must be ignored, provided there is at
77+ least one whitespace character after it::
78+
79+ # Not valid because of the "d" after ignore; does not supress the type error
80+ s: str = 1 # type: ignored
81+ # Not valid because of the comma; does not supress the type error
82+ s: str = 1 # type: ignore, because I feel like it
83+ # This is valid because of the whitespace and must suppress the type error
84+ s: str = 1 # type: ignore because why not
85+
86+ The form of ``# type: ignore[...] `` may be used to filter errors depending on
87+ the type checker:
88+
89+ - In ``# type: ignore[my_code1] ``, a type checker may ignore the error code
90+ ``my_code1 `` and choose to treat this form as equivalent to ``# type: ignore ``.
91+ - Alternatively in ``# type: ignore[my_code1] `` a type checker may suppress the
92+ error only if the error cause matches the error code ``my_code1 ``.
93+ - ``# type: ignore `` must always suppress all errors.
8294
8395.. _`cast` :
8496
0 commit comments