RSSAmplifier

how.wtf · Dec 16, 2023

ABC vs Protocol in Python

0
Sign in to vote or save

This site does not allow itself to be embedded. You can still read it on the original site — the toolbar below keeps your place in the directory.

Before typing was released for Python, the ABC class reigned as champion for describing shape and behaviors of classes. After type annotations, ABC and @abstractmethod were still used to describe the behaviors: they felt ‘interface-like’. Then, Protocol was released and introduced a new way for declaring class behaviors. Should you use ABC or Protocol? Before describing why or why not…

Read on how.wtf

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.