Abc and Protocols are not the same, though. The protocol is met when all methods are implemented with the expected signature. Abstract base classes require you to opt in to be considered an Implementation of some interface. Both have different use cases. Protocols are much more fragile.
The opposite is true. If you have two interfaces that contain methods with the same name, then they have the same typing.Protocol. It is not possible to specify preconditions or contracts, as you would with abc.
Abc and Protocols are not the same, though. The protocol is met when all methods are implemented with the expected signature. Abstract base classes require you to opt in to be considered an Implementation of some interface. Both have different use cases. Protocols are much more fragile.
I wouldn’t say Protocols are more “fragile”… They’re more strict.
The opposite is true. If you have two interfaces that contain methods with the same name, then they have the same
typing.Protocol
. It is not possible to specify preconditions or contracts, as you would with abc.