Whereas with Protocols it's gonna be ( good tutorial ): I think that is not a good example of how to write programs. What he did by having protocols I would have done by using mixins. The way that I see objects is that they have various capabilities that can be mixed in. multiple inheritance in python would have been a much better way to implement that example in my opinion. I would also say that the author of this tutorial needs to learn a thing or 2 about an inversion of control and dependency injection. The author basically sets up a straw man problem and then solves his straw man problem. He had no business creating instances of the object outside of the class itself. If he had simply called a constructor methods within the classes then the other class wouldn't have been attempting to make instances of those other classes. Answer from thedeepself on reddit.com
🌐
Sinavski
sinavski.com › home › interfaces abc vs. protocols
Interfaces: abc vs. Protocols - Oleg Sinavski
August 1, 2021 - They allow you to avoid messy inheritance altogether. Last but not least, you can count the number of lines of code you need to define an interface. With abc, you must have an abstractmethod decorator for every method.
🌐
Reddit
reddit.com › r/python › protocols vs abstract base classes in python
r/Python on Reddit: Protocols vs Abstract Base Classes in Python
December 1, 2024 -

Hi everyone. Last time I shared a post about Interface programming using abs in Python, and it got a lot of positive feedback—thank you!

Several people mentioned protocols, so I wrote a new article exploring that topic. In it, I compare protocols with abstract base classes and share my thoughts and experiences with both. You can check it out here: https://www.tk1s.com/python/protocols-vs-abstract-base-classes-in-python Hope you'll like it! Thanks!

🌐
Reddit
reddit.com › r/python › interfaces with protocols: why not ditch abc for good?
r/Python on Reddit: Interfaces with Protocols: why not ditch ABC for good?
January 22, 2023 -

Hello, if one finds interfaces useful in Python (>=3.8) and is convinced that static type-checking is a must, then why not ditch ABC and always use Protocols? I understand that the fundamental idea of a protocol is slightly different from an interface, but in practice, I had great success replacing abc's with Protocols without regrets.

With abc you would write (https://docs.python.org/3/library/abc.html) :

from abc import ABC, abstractmethod

class Animal(ABC):
   @abstractmethod
   def eat(self, food) -> float:
       pass

Whereas with Protocols it's gonna be (good tutorial):

from typing import Protocol

class Animal(Protocol):
   def eat(self, food) -> float:
       ...

Scores in my subjective scoring system :)

CapabilityABCProtocols
Runtime checking11 (with a decorator)
Static checking with mypy11
Explicit interface (class Dog(Animal):)11
Implicit interface with duck-typing (class Dog:)0.5 (kind of with register, but it doesn't work with mypy yet)1
Default method implementation (def f(self): return 5)-1 (implementations shouldn't be in the interfaces)-1 (same, and mypy doesn't catch this)
Callback interface01
Number of code lines-1 (requires ABC inheritance and abstracmethod for every method)0 (optionalProtocol inheritance)
Total score1.54

So I do not quite see why one should ever use ABC except for legacy reasons. Other (IMHO minor) points in favour of ABC I've seen were about interactions with code editors.

Did I miss anything?

I put more detailed arguments into a Medium. There are many tutorials on using Protocols, but not many on ABC vs Protocols comparisons. I found a battle of Protocols vs Zope, but we are not using Zope, so it's not so relevant.

🌐
Justin A. Ellis
jellis18.github.io › post › 2022-01-11-abc-vs-protocol
Abstract Base Classes and Protocols: What Are They? When To Use Them?? Lets Find Out! - Justin A. Ellis
January 11, 2022 - Use ABCs if you will need several implementations of a class with several methods. Use Protocols for strict type annotations (i.e.only annotate the methods/attributes you need) ... Well, thats it for this time. Now go forth into our bold almost statically typed python future with confidence!
🌐
Medium
medium.com › @pouyahallaj › introduction-1616b3a4a637
Python Protocols vs. ABCs: A Comprehensive Comparison of Interface Design | Medium
May 29, 2023 - However, ABCs in Python have some shortcomings. One of the main limitations is that they rely on subclassing, meaning a class can only inherit from one ABC. This restriction can be problematic in cases where multiple inheritance is needed. This is where Protocols come into play.
🌐
Python.org
discuss.python.org › ideas
Make abc.ABC a regular class by making __instancecheck__ and __subclasscheck__ class methods - Page 3 - Ideas - Discussions on Python.org
March 4, 2024 - __instancecheck__ and __subclasscheck__ on ABCMeta already does something like that, except in C, so it’s fast, all you’re really changing is moving the code from ABCMeta[1] to isinstance/issubclass, which is fine if you’re allowing all classes to register virtual subclasses, but it will add static overhead to all isinstance calls, there’s not really a way to avoid that or trade it against the dynamic dispatch overhead, since that is part of Python’s data model. or rather _abc if we’re talk...
🌐
GitConnected
levelup.gitconnected.com › python-interfaces-choose-protocols-over-abc-3982e112342e
Python interfaces: abandon ABC and switch to Protocols | by Oleg Sinavski | Level Up Coding
January 19, 2023 - A protocol is a formalization of Python’s “duck-typing” ideology. There are many great articles on structural typing in Python (for example, see this tutorial). Protocols and interfaces are different beasts in theory, but a protocol does the job. I had great success replacing abc with Protocols without any downsides.
Find elsewhere
🌐
Python
typing.python.org › en › latest › spec › protocol.html
Protocols — typing documentation
If Protocol is included in the base class list, all the other base classes must be protocols. A protocol can’t extend a regular class. Note that rules around explicit subclassing are different from regular ABCs, where abstractness is simply defined by having at least one abstract method being unimplemented.
🌐
GitHub
github.com › python › typing › discussions › 1793
Variance of arguments for Generic ABC vs Generic Protocol · python/typing · Discussion #1793
July 9, 2024 - """ @abc.abstractmethod def write( self, result: R, ) -> R: """ Write to destination """ Beta Was this translation helpful? Give feedback. ... Full TypeVar variance consistency is checked only for protocols (as indicated in the typing spec), not for nominal class definitions (including ABCs).
Author   python
🌐
TypeThePipe
typethepipe.com › post › python-protocols-when-to-use
Python protocols. When to use them in your projects to abstract and decoupling | TypeThePipe
December 11, 2023 - Protocols, on the other hand, are more generic and loosely coupled. They are used primarily for type checking, allowing Python to understand that certain classes are “compatible” or fulfill a specific interface, without those classes necessarily ...
🌐
YouTube
youtube.com › arjancodes
Protocols vs ABCs in Python - When to Use Which One? - YouTube
💡 Learn how to design great software in 7 steps: https://arjan.codes/designguide.In this video, I’m revisiting Protocols and ABCs in Python, essential for c...
Published   March 29, 2024
Views   41K
🌐
Real Python
realpython.com › python-protocol
Python Protocols: Leveraging Structural Subtyping – Real Python
July 25, 2024 - Some of the most common predefined protocols include the following: Even though these classes are abstract base classes (ABC) rather than formal protocols, you can use them as protocols in your type hints.
🌐
Medium
medium.com › @tconsta › python-interfaces-abc-protocol-or-both-3c5871ea6642
Modern Python Interfaces: ABC, Protocol, or Both?
November 14, 2025 - ABCs belong to the “nominal” world — you declare you are something by inheriting from a base class. Python enforces abstract methods at runtime; try to instantiate an incomplete subclass and you get an error.
🌐
Medium
medium.com › @kandemirozenc › understanding-interfaces-abc-protocol-and-duck-typing-in-python-866ca32ab2a0
Understanding Interfaces, ABC, Protocol and Duck Typing in Python | by kandemirozenc | Medium
December 7, 2024 - Introduced in Python 3.8, Protocol provides a lightweight and flexible way to define expected behaviors. Unlike abc, Protocols do not enforce method implementation at runtime.
🌐
Idego Group
idego-group.com › other › we need to talk about protocols in python
We need to talk about Protocols in Python | Idego Group
February 22, 2023 - They handle dependency problems differently – while ABCs, depending on class hierarchy, focus on instance creation, Protocols are dedicated for instance usage thanks to the duck typing mechanism.
🌐
Medium
medium.com › pyzilla › python-protocols-vs-abc-why-modern-interfaces-deserve-a-smarter-choice-c46591644ff2
Python Protocols vs ABC: Why Modern Interfaces Deserve ...
September 15, 2025 - In Python, we don’t have a built-in interface keyword (Java devs cry in curly braces). Instead, Python gives us two main paths: Abstract Base Classes (ABC) — the formal, rigid path. Protocols — the flexible, structural path.
🌐
Python
docs.python.org › 3 › library › abc.html
abc — Abstract Base Classes
Finally, the last line makes Foo a virtual subclass of MyIterable, even though it does not define an __iter__() method (it uses the old-style iterable protocol, defined in terms of __len__() and __getitem__()). Note that this will not make get_iterator available as a method of Foo, so it is provided separately. The abc module also provides the following decorator:
🌐
GitHub
github.com › ArjanCodes › 2021-protocol-vs-abc
GitHub - ArjanCodes/2021-protocol-vs-abc: Protocols vs ABC - which one should you use when? · GitHub
Protocols vs ABC - which one should you use when? Contribute to ArjanCodes/2021-protocol-vs-abc development by creating an account on GitHub.
Starred by 39 users
Forked by 12 users
Languages   Python
🌐
Medium
medium.com › algomart › abstract-base-classes-vs-protocols-in-python-a-real-world-perspective-bdc85b74f48c
Abstract Base Classes vs. Protocols in Python: A Real-World Perspective | by Yash Jain | AlgoMart | Medium
June 18, 2025 - To prevent these issues before they happen, Python offers two methods to define and enforce behavior across different parts of a codebase: Abstract Base Classes (ABCs) Protocols · Both help with defining common patterns. But they do it differently. Let’s walk through each, from scratch — not with jargon, but from the angle of how a typical developer would use them on the job.