Created
September 10, 2021 08:01
-
-
Save mypy-play/eee87e8bd584c64eec5b90307e95f4ea to your computer and use it in GitHub Desktop.
Shared via mypy Playground
This file contains 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 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