Re:I Want a New Duck (2020)
by war1025 on Thursday March 18, 2021 @05:14PM
(#26507626)
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.
Re:I Want a New Duck (2020)
by thechao on Thursday March 18, 2021 @05:54PM
(#26507968)
These protocols match the old Indiana `concepts` pretty precisely; they appear to be more like Haskell type-classes than interfaces -- they're retroactive, not inherited.
A Protocol is just the same structural subtyping (duck typing) Python has always preferred.