Skip to content

Instantly share code, notes, and snippets.

@kunigami

kunigami/type_var.py

Created Dec 26, 2019
Embed
What would you like to do?
T = TypeVar('T')
def first(xs: List[T]) -> Optional[T]:
if (len(xs) == 0):
return None
return xs[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.