diff --git a/docs/source/command_line.rst b/docs/source/command_line.rst index 310bb78a293b..c9d09304777c 100644 --- a/docs/source/command_line.rst +++ b/docs/source/command_line.rst @@ -536,6 +536,18 @@ potentially problematic or redundant in some way. # Error: 'Statement is unreachable' error print(x + "bad") + Note that unreachable ``pass`` statements are intentionally not + reported by this option. This allows ``pass`` to be used as a + placeholder during development without triggering an error. + + .. code-block:: python + + def f(x: int) -> None: + if x > 0: + return + pass # no --warn-unreachable error is reported here + + To help prevent mypy from generating spurious warnings, the "Statement is unreachable" warning will be silenced in exactly two cases: