Last active
July 27, 2020 14:34
-
-
Save bitglue/edec3b65688adcb6a4776094284de1c2 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
$ mypy null.py | |
null.py:16: error: Argument 1 to "foo" has incompatible type "None"; expected "Bar" | |
Found 1 error in 1 file (checked 1 source file) |
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 | |
class Bar: | |
pass | |
def foo(b: Bar): | |
print(b) | |
def maybe_foo(b: Optional[Bar]): | |
print(b) | |
foo(None) | |
maybe_foo(None) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment