Created
July 22, 2024 00:59
-
-
Save mypy-play/2f45500a477c0ef501d9928e24b0896a to your computer and use it in GitHub Desktop.
Shared via mypy Playground
This file contains 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
from typing import TypeVar | |
T1 = TypeVar("T1") | |
T2 = TypeVar("T2") | |
def f(t1: T1, t2: T2) -> T1 | T2: | |
return t1 | |
a: int = f(1, None) or 1 | |
def f1(t1: T1, t2: T1) -> T1: | |
return t1 | |
b: int = f1(1, None) or 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment