Skip to content

Instantly share code, notes, and snippets.

@mypy-play
Created September 10, 2021 08:01
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 mypy-play/eee87e8bd584c64eec5b90307e95f4ea to your computer and use it in GitHub Desktop.
Save mypy-play/eee87e8bd584c64eec5b90307e95f4ea to your computer and use it in GitHub Desktop.
Shared via mypy Playground
from typing import Literal
def f(color: Literal["red", "green", "blue"]):
print(color)
s = None
if True:
s = "red"
else:
s = "blue"
f(s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment