-
-
Save saml/8f7ca0f5845760fee77c1470f183a2ce to your computer and use it in GitHub Desktop.
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 Optional | |
a: Optional[str] = None | |
def init(): | |
global a | |
a = 'abc' | |
def g() -> str: # supposed to be called after calling init() | |
return a | |
# $ mypy a.py | |
# a.py:8: error: Incompatible return value type (got "Optional[str]", expected "str") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment