Explain ABCs and Protocols.
Skip to solutionKEEP THE
mediumDSA
What are abstract base classes and Protocols?
924 views
01
Understand the problem
abcprotocol
02
Attempt it yourself
Sketch your approach before reading the solution — that's what interviews test.
Nudge consolestandby
Stuck? Beam a request up — the console returns a conceptual nudge that guides your logic without spoiling the implementation.
03
Study the solution
ABCs (abc module) define interfaces with @abstractmethod that subclasses must implement (nominal). Protocols (typing.Protocol) enable structural/duck typing for static checks — any class with the right methods satisfies it, no explicit inheritance needed.
Solution ready — 2 min read
Classified // press E to declassify
04
Run the code
PYABC enforces; Protocol matches by shape (no inheritance)
05
Join the discussion
Discussion (0)
Sign in to join the discussion.
No responses yet. Be the first to share what you think.
Transmission complete // awaiting log
KEEP THE
STREAK ALIVE.
Dossier 41 of 120 decoded in the Python track. One more won't hurt.