Skip to content

Instantly share code, notes, and snippets.

@mypy-play
Created November 14, 2025 07:32
Show Gist options
  • Select an option

  • Save mypy-play/e316d3d5b495cb113cacc9c55136dea7 to your computer and use it in GitHub Desktop.

Select an option

Save mypy-play/e316d3d5b495cb113cacc9c55136dea7 to your computer and use it in GitHub Desktop.
Shared via mypy Playground
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