File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,14 @@ and is also present in ``typing_extensions`` starting at version 4.1.
8686However, it is also possible to define a similar function in your own
8787code, for example if you want to customize the runtime error message.
8888
89+ This use of match statements for comprehensive matching is common
90+ enough that some typecheckers have direct support for checking all match
91+ statements for exhaustiveness, regardless of whether or not they have an
92+ ``assert_never ``-style function in their default arm. For instance, in pyright
93+ this can be enabled by enabling the diagnostic code ``reportMatchNotExhaustive ``
94+ (on by default in strict mode), and in mypy it can be enabled by enabling
95+ the error code ``exhaustive-match ``.
96+
8997You can also use ``assert_never() `` with a sequence of ``if `` statements:
9098
9199.. code :: python
You can’t perform that action at this time.
0 commit comments