Created
March 12, 2026 11:57
-
-
Save mypy-play/ea22403f32e4feaf26f4a73db7f2210e 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
| #!/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