Created
November 14, 2025 07:32
-
-
Save mypy-play/e316d3d5b495cb113cacc9c55136dea7 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
| import enum | |
| import typing | |
| class Op(enum.Enum): | |
| A = "a" | |
| B = "b" | |
| def run(op: Op): | |
| if op in (Op.A,): | |
| typing.reveal_type(op) | |
| return | |
| elif op == Op.B: | |
| typing.reveal_type(op) | |
| return | |
| else: | |
| typing.assert_never(op) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment