Skip to content

Commit bd841e7

Browse files
[docs] explain ignoring unused-ignoremore explicitly
1 parent feeb3f0 commit bd841e7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

docs/source/error_code_list2.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,12 @@ Example:
481481
# Error: unused "type: ignore" comment
482482
return a + b # type: ignore
483483
484-
Note that due to a specific nature of this comment, the only way to selectively
485-
silence it, is to include the error code explicitly. Also note that this error is
486-
not shown if the ``# type: ignore`` is not used due to code being statically
484+
Mypy errors can typically be silenced by putting a ``# type: ignore`` comment after them,
485+
but because this is *already* a ``# type: ignore`` comment, the only way to selectively
486+
silence it is to include the error code explicitly, making the comment
487+
``# type: ignore[unused-ignore]``.
488+
489+
This error is not shown if the ``# type: ignore`` is not used due to code being statically
487490
unreachable (e.g. due to platform or version checks).
488491

489492
Example:

0 commit comments

Comments
 (0)