Skip to content

Instantly share code, notes, and snippets.

@kunigami
Created December 26, 2019 03:43
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 kunigami/fde4b9553dcff1dc9927a403b2d9fd55 to your computer and use it in GitHub Desktop.
Save kunigami/fde4b9553dcff1dc9927a403b2d9fd55 to your computer and use it in GitHub Desktop.
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