Check that called function returns a value [func-returns-value]
Mypy reports an error if you call a function with a None
return type and don’t ignore the return value, as this isusually (but not always) a programming error.
In this example, the if f()
check is always false since f
returns None
:
- def f() -> None:
- ...
- # OK: we don't do anything with the return value
- f()
- # Error: "f" does not return a value [func-returns-value]
- if f():
- print("not false")