Replies: 1 comment 1 reply
-
I found that the Python typing team has published example code that endorses use of Edit: |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'd like to call
assert_never
in the irrefutable branch of amatch
statement:Calling
assert_never
like this (as opposed to omitting the final match case) has some benefits:case never
won't be reached.AssertionError
at runtime if the case is reached due to a bug.Pyright complains about the above usage:
My solution for now is to ignore this pyright error:
Is there a better way to assert that the match arms are exhaustive (i.e. one that doesn't trigger a pyright error)? If not, @msfterictraut, would you be amenable to a feature request to ease pyright's error reporting for this use-case?
Beta Was this translation helpful? Give feedback.
All reactions