3 ms·
Python does have something like interfaces and it’s called Protocols https://docs.python.org/3/library/typing.html#typing.Protocol https://docs.python.org/3/lib
by bionhoward 2y ago
Python does have something like interfaces and it’s called Protocols https://docs.python.org/3/library/typing.html#typing.Protocol https://docs.python.org/3/library/typing.html#typing.Protoco...
Other classes can count as implementors of protocols without needing to subclass them, and static type hints will notify you if you make a function which accepts a protocol as an argument and pass something which doesn’t implement it