3 ms·
The difference between "Interfaces" as I have seen them used most of the time, and "Protocols" as mypy uses them, is that usually an Interface is generally part
by war1025 6y ago
The difference between "Interfaces" as I have seen them used most of the time, and "Protocols" as mypy uses them, is that usually an Interface is generally part of the inheritance hierarchy.
A Protocol is just the same structural subtyping (duck typing) Python has always preferred.
- thechao 6y agoThese protocols match the old Indiana `concepts` pretty precisely; they appear to be more like Haskell type-classes than interfaces -- they're retroactive, not inherited.
- deleted 6y ago[deleted]