Skip to content

Instantly share code, notes, and snippets.

@jaycosaur
Created August 9, 2020 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaycosaur/23e6dd8d8451df432208adc0d43890a5 to your computer and use it in GitHub Desktop.
Save jaycosaur/23e6dd8d8451df432208adc0d43890a5 to your computer and use it in GitHub Desktop.
Generics [python] - Typescript to Python field guide
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