I prefer ABCs beacuse they're explicit. With a Protocol someone reading the code may not know your class is intended to implement an interface in another module or deep in a dependency. Similarly, you can accidentally conform to a Protocol's signature, without conforming to its contract. For example, if a function accepts a

class Image(Protocol):
    def draw() -> None:
        ...

it's obviously not going to make sense with a

class Cowboy:
    def draw() -> None:
         ...

but the type checker would happily accept it.

Answer from joel on Stack Overflow
🌐
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!
🌐
GitHub
gist.github.com › Integralist › cc04c2c34a988be26e56fe2f3ea95aff
[Python Interfaces via Protocols and Abstract Base Classes (with Metaclasses)] #python #interfaces #protocols #design #collections #abc #iterator #sized #metaclasses #abstract · GitHub
Instead, Python provides 'protocols' which are a bit like the interface support in Go. They're not strictly enforced, but if you implement specific magic methods you'll find a selection of builtin Python functions become available to use on ...
🌐
Han
han8931.github.io › python-protocol-abstract-classes
Abstract Classes or Protocols - Han's XYZ
September 15, 2025 - An abstract class in Python is a class that cannot be instantiated on its own and is designed to be a blueprint for other classes. It allows you to define methods that must be created within any child classes built from the abstract class.
🌐
Medium
medium.com › @pouyahallaj › introduction-1616b3a4a637
Python Protocols vs. ABCs: A Comprehensive Comparison of Interface Design | Medium
May 29, 2023 - Protocols enable you to define ... and Abstract Base Classes (ABCs) share similarities in defining interfaces, but they also have distinct differences in syntax, usage, and intended purposes....
🌐
Sinavski
sinavski.com › home › interfaces abc vs. protocols
Interfaces: abc vs. Protocols - Oleg Sinavski
August 1, 2021 - But recently, I found that relatively new Python Protocols are way nicer. People find uses for both technologies. But I want to convince you to completely jump ships and start using them instead of more traditional techniques. Python is somewhat different from other popular languages since there are no interfaces on a language level. However, there are several library implementations: ... from abc import ABC, abstractmethod class Animal(ABC): @abstractmethod def eat(self, food) -> float: pass @abstractmethod def sleep(self, hours) -> float: pass
🌐
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!

🌐
UW PCE
uwpce-pythoncert.github.io › Py300 › ABCs.html
Abstract Base Classes and standard class protocols — Py300 3.0 documentation
In particular, the protocols of the standard Python object types. They were added to Python to formalize the “Duck Typing” approach in some contexts. See PEP 3119 for the details: ... In OO languages, an “abstract” class is a class that has an interface, but no implementation.
Find elsewhere
🌐
Reddit
reddit.com › r/python › python interfaces: choose protocols over abc
r/Python on Reddit: Python Interfaces: Choose Protocols Over ABC
February 12, 2023 - ... There is a substantial difference: abstract class ensures that an implementation meets certain requirements when a subclass is declared, while protocol checks if an instance meets certain requirements when it's being used.
🌐
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 - But recently, I found that relatively new Python Protocols are way nicer. People find uses for both technologies. But I want to convince you to completely jump ships and start using them instead of more traditional techniques. Python is somewhat different from other popular languages since there are no interfaces on a language level. But there are several library implementations. The abc package is probably the most popular: from abc import ABC, abstractmethod class Animal(ABC): @abstractmethod def eat(self, food) -> float: pass @abstractmethod def sleep(self, hours) -> float: pass
🌐
GitHub
github.com › ArjanCodes › 2021-protocol-vs-abc
GitHub - ArjanCodes/2021-protocol-vs-abc: Protocols vs ABC - which one should you use when? · GitHub
When should you use protocol classes vs abstract base classes?
Starred by 39 users
Forked by 12 users
Languages   Python
🌐
Hacker News
news.ycombinator.com › item
Where would you use `typing.Protocol` where you wouldn't use an abstract base cl... | Hacker News
March 19, 2021 - The only time I've ever used `Protocol` is to define a type that makes it explicit that I need an object to have a `__str__` implementation: · Abstract base classes require everything to extend from a base-level object, and also inherit it's default implementations.
🌐
YouTube
youtube.com › arjancodes
Protocol Or ABC In Python - When to Use Which One? - YouTube
💡 Learn how to design great software in 7 steps: https://arjan.codes/designguide.When should you use protocol classes vs abstract base classes? Here's an ex...
Published   October 29, 2021
Views   204K
🌐
Romerogabriel
romerogabriel.github.io › mastering-python › classes_objects › interfaces_protocols_abc
Interfaces, Protocols, and ABCs - Mastering Python
An object can implement only a part of a dynamic protocol and still be functional, whereas a static protocol mandates the provision of every method declared in the protocol class, irrespective of the program's requirements. Static protocols can be verified by static type checkers, which is not possible for dynamic protocols. Python offers another explicit means of defining an interface in code: the abstract base class (ABC).
🌐
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.

🌐
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 - This functionality is integrated into the structure of these classes. 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 ...
🌐
Old Dominion University
cs.odu.edu › ~tkennedy › cs263 › dev › Public › protocolVsABC › index.html
Protocol vs Abstract Base Class
Currently, PEP 484 and the typing module [typing] define abstract base classes for several common Python protocols such as Iterable and Sized. The problem with them is that a class has to be explicitly marked to support them, which is unpythonic and unlike what one would normally do in idiomatic ...
🌐
Python
peps.python.org › pep-0544
PEP 544 – Protocols: Structural subtyping (static duck typing) | peps.python.org
A class can explicitly inherit from multiple protocols and also from normal classes. In this case methods are resolved using normal MRO and a type checker verifies that all subtyping are correct. The semantics of @abstractmethod is not changed, all of them must be implemented by an explicit subclass before it can be instantiated.
🌐
Real Python
realpython.com › python-protocol
Python Protocols: Leveraging Structural Subtyping – Real Python
July 25, 2024 - In this new implementation, you use a protocol instead of an ABC. Now, you don’t rely on inheritance for your type hints to work correctly. Your classes are decoupled from each other. Their only point of coincidence is that they have a piece of interface in common. In short, the main difference between an abstract base class and a protocol is that the former works through a formal inheritance relationship, while the latter doesn’t need this relationship.
🌐
DEV Community
dev.to › meseta › factories-abstract-base-classes-and-python-s-new-protocols-structural-subtyping-20bm
Python's new Protocols (Structural subtyping), Abstract Base Classes, and Factories - DEV Community
August 18, 2020 - That way there's no ambiguity about whether the documentation still matches the code, since this definition of the class is what is used at runtime, and will error out if the implementation was incorrect. Python has a built-in library for this called abc which stands for Abstract Base Class.