Abstract Factories In Python

Learn about the usage of the Abstract Factory pattern in Python.

Conceptualizing Abstract Factory without a base class

The example in the previous lesson highlights an interesting consequence of the way Python’s duck typing works. Do we really need the abstract base class, CardGameFactory? It provides a framework used for type checking but otherwise doesn’t have any useful features. Since we don’t really need it, we can think of this design as having three parallel modules:

Get hands-on with 1200+ tech skills courses.