Functions that correctly implement a callable protocol should be considered as implementing said protocol when checking for subtypes / protocol implementations. First mentioned here.
Motivation
Currently implements_protocol does not check if functions implement the protocol and returns False when the value is a function. Since these are valid implementations of the protocol implements_protocol should return true such that the parser can identify them as valid subtypes / implementations.
Pitch
Consider the following callable interface and two valid implementations:
🚀 Feature request
Functions that correctly implement a callable protocol should be considered as implementing said protocol when checking for subtypes / protocol implementations. First mentioned here.
Motivation
Currently implements_protocol does not check if functions implement the protocol and returns
False
when the value is a function. Since these are valid implementations of the protocolimplements_protocol
should return true such that the parser can identify them as valid subtypes / implementations.Pitch
Consider the following callable interface and two valid implementations:
The current behavior of
def implements_protocol(value, protocol) -> bool:
is:It should be:
Alternatives
?