Only use annotations of @overload
ed functions to type check the implementation
#8867
Labels
@overload
ed functions to type check the implementation
#8867
Consider the following real-world example of a function. The type of one of the parameters of this function depends on another one:
It doesn't typecheck as if you only look at the annotations of the implementation, the signature of the factory is ambiguous:
I don't think it's possible to annotate the implementation in such a way that it would typecheck. So it would be nice if mypy used the signatures of the
@overload
ed methods, and one wouldn't have to annotate the signature of the implementation at all. Even if you could annotate it in such a way that it would typecheck, wouldn't it be redundant?The text was updated successfully, but these errors were encountered: