The expressiveness of the Callable type is somewhat limited. As recommended in the typing docs, in order to support richer and more precise generic function types, and applications like #526 that would consume them, we'd need to support callable Protocols in our type inference engine.
The PR #613 includes an encoding of inspect.Signatures as TypedDicts, so that TypedDict inference can be repurposed to support structural function type inference. Assuming that's correct, we could probably address this issue straightforwardly without the much bigger lift of supporting Protocols in general by building on top of that machinery.
The expressiveness of the
Callabletype is somewhat limited. As recommended in thetypingdocs, in order to support richer and more precise generic function types, and applications like #526 that would consume them, we'd need to support callableProtocols in our type inference engine.The PR #613 includes an encoding of
inspect.Signatures asTypedDicts, so thatTypedDictinference can be repurposed to support structural function type inference. Assuming that's correct, we could probably address this issue straightforwardly without the much bigger lift of supportingProtocols in general by building on top of that machinery.