Skip to content

Instantly share code, notes, and snippets.

@bitglue
Last active July 27, 2020 14:34
Show Gist options
  • Save bitglue/edec3b65688adcb6a4776094284de1c2 to your computer and use it in GitHub Desktop.
Save bitglue/edec3b65688adcb6a4776094284de1c2 to your computer and use it in GitHub Desktop.
$ 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)
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