
One clarification: On Wed, Jan 19, 2022 at 8:39 AM Henry F. Schreiner <henryfs@princeton.edu> wrote:
# --exhaustive-match flag for checkers like mypy
This would be a new “strict' flag added to mypy “strict” that would force match statements to be statically exhaustive - this is not (and maybe could not) be enforced at runtime by Python,
It could have been, but the PEP 634 authors chose not to require it, so it should not be enforced at runtime.
but could for a static type checker, and would force case _: pass to be added if fallthrough was expected - to make it explicit, and avoid forgetting to add case _: assert False. At some some codebases would likely benefit from this flag. I assume this could be done by other checkers too. It would be a normal mypy strictness flag, so could be enabled/disabled per module, etc.
-- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-c...>