...
/Abstract Base Classes and Type Hints
Abstract Base Classes and Type Hints
Learn about the difference between the abstract base classes vs. generic classes and the usage of type hints in Python.
We'll cover the following...
Overview
The concept of an abstract base class is closely tied to the idea of a generic class. An abstract base class is often generic concerning some detail supplied by a concrete implementation.
Most of Python’s generic classes – classes like list
, dict
, and set
– can be used as type hints, which can be parameterized to narrow the domain. There’s a world of difference between list[Any]
and list[int]
; the value ...