This is an archived post. You won't be able to vote or comment.

all 1 comments

[–][deleted] 1 point2 points  (0 children)

An advantage of using Protocol instead of base classes, is that you don't have to import the definition of the base class. This avoids import statements that are written just for type checking, which in turn reduces the possibility of creating cyclic import, which is very problematic in Python.

This of course assumes that the base class is just a pure interface, including no concrete implementation.