Skip to content

Instantly share code, notes, and snippets.

@MartinThoma
Created October 2, 2021 10:07
Show Gist options
  • Save MartinThoma/177df42a9ed7dbef4433b0d22e5d99d9 to your computer and use it in GitHub Desktop.
Save MartinThoma/177df42a9ed7dbef4433b0d22e5d99d9 to your computer and use it in GitHub Desktop.
# Before 3.10
from typing import Union
def foo() -> Union[float, str]: ...
isinstance(bar (float, int))
# With 3.10
def foo(a: int) -> float | str: ...
isinstance(bar, float | int)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment