Created
February 11, 2021 17:02
-
-
Save arsalan0c/d6d3eb28ef4bc7b9a6405253680f814b to your computer and use it in GitHub Desktop.
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 Callable | |
from typing import TypeVar | |
A = TypeVar('A') | |
B = TypeVar('B') | |
def apply(f: Callable[[A],B], a: A): | |
return f(a) | |
def fst(a: A, b: B): | |
return a | |
def a(n): | |
return n | |
apply(a, 10) | |
fst(10, "str") | |
from typing import Union | |
def Add(a: Union[str, int], b: Union[str, int]) -> Union[str, int]: | |
return a + b | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment