Created
August 9, 2020 11:53
-
-
Save jaycosaur/23e6dd8d8451df432208adc0d43890a5 to your computer and use it in GitHub Desktop.
Generics [python] - Typescript to Python field guide
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, Sequence, Tuple | |
T = TypeVar("T") | |
def variadic(*args: T) -> Sequence[T]: | |
return args | |
A = TypeVar("A") | |
B = TypeVar("B") | |
def multi_generic(arg_a: A, arg_b: B) -> Tuple[A, B]: | |
return (arg_a, arg_b) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment