Closed twoertwein closed 1 year ago
I think this is bad style, and is disallowed by e.g. pylint's inconsistent-return-statements
and pyanalyze's missing_return
.
It would also be quite complicated to try to infer all possible program flows through a function.
I am going to document this as a known limitation. I don't want to add the logic to implement this properly to autotyping. In the general case (e.g., an exhaustive match statement over an enum) it requires the capabilities of a full type checker.
autotyping annotates the following function as returning
bool
but it should bebool | None
(example from pandas/util/_test_decorators.py)