Created
August 9, 2020 11:45
-
-
Save jaycosaur/7271cf1ec4fdfdbe0178d67a346d8ee6 to your computer and use it in GitHub Desktop.
Union types [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 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