Created
November 13, 2025 20:38
-
-
Save mypy-play/6063ab2f7a7a97f7ee4abb1f2019d225 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 sys | |
| from typing import final | |
| @final | |
| class A: ... | |
| @final | |
| class B: ... | |
| if sys.version_info >= (3, 14): | |
| type MyAlias = A | B | |
| else: | |
| type MyAlias = A | |
| def f(x: MyAlias): | |
| if isinstance(x, B): | |
| reveal_type(x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment