-
-
Save hackaugusto/67658a0ee1e59d97ce40f81085ed3116 to your computer and use it in GitHub Desktop.
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
| from typing import TypeVar, Callable, Tuple, overload, Any | |
| T1 = TypeVar('T1') | |
| T2 = TypeVar('T2') | |
| T3 = TypeVar('T3') | |
| R = TypeVar('R') | |
| @overload | |
| def f(c: Callable[[T1], R], A: Tuple[T1]) -> R: ... | |
| @overload | |
| def f(c: Callable[[T1, T2], R], A: Tuple[T1, T2]) -> R: ... | |
| @overload | |
| def f(c: Callable[[T1, T2, T3], R], A: Tuple[T1, T2, T3]) -> R: ... | |
| def f(c, a): | |
| return c(*a) | |
| def t1(a: int) -> None: | |
| pass | |
| def t2(a: str, b: int) -> None: | |
| pass | |
| def t3(a: int, b: int) -> None: | |
| pass | |
| f(t1, ('2',)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment