Skip to content

Instantly share code, notes, and snippets.

@jaycosaur
Created August 9, 2020 11:45
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jaycosaur/7271cf1ec4fdfdbe0178d67a346d8ee6 to your computer and use it in GitHub Desktop.
Union types [python] - Typescript to Python field guide
from typing import Union
StringOrNumber = Union[str, int]
something_good: StringOrNumber = "123" # ok!
something_bad: StringOrNumber = {} # not ok!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment