Closed
Description
I came across this while reading Daniel Moisset's impression of mypy. He mentions satisfying mypy by wrapping a boolean return expression in bool()
, which I think is unnecessary. Below is a simple example that mypy fails on with Incompatible return value type (got "Union[str, bool]", expected "bool")
. Note that the return expression is of the form <expression> and <comparison> or <comparison>
.
def bool_expr_test(line: str) -> bool:
return line and line[0] == '"' or line[0] == "'"
Tested on 64c0acd and 0.4.3 (from pip
).
Metadata
Metadata
Assignees
Labels
No labels