Skip to content

Instantly share code, notes, and snippets.

@mypy-play
Created March 12, 2026 11:57
Show Gist options
  • Select an option

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

Select an option

Save mypy-play/ea22403f32e4feaf26f4a73db7f2210e to your computer and use it in GitHub Desktop.
Shared via mypy Playground
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from enum import Enum
from typing import assert_never
class A(Enum):
A0 = "0"
A1 = "1"
def test(a: A) -> bool:
match a:
case A.A0:
return True
case _ as never:
assert_never(never)
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment