Created
June 4, 2025 14:09
-
-
Save mypy-play/b1af4c5dd963eecfaa62b8fb6034420a to your computer and use it in GitHub Desktop.
Shared via mypy Playground
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from enum import Enum | |
class Foo(Enum): | |
A = 0 | |
B = 0 | |
def bar(foo: Foo) -> None: | |
if foo is Foo.A: | |
... | |
elif foo is Foo.B: | |
... | |
else: | |
# some long other logic for whatever reason. | |
# should be marked as unreachable | |
message = "unknown Foo" | |
raise ValueError(message, foo) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment