
Abstract Base Class (ABC) in Python
I completed the tutorial by Raymond Hettinger “Build powerful, new data structures with Python's abstract base classes” offered by YouTube. In this tutorial I learned: • What Abstract Classes are all about • Strategies for using ABCs (pure abstract classes, the framework design pattern, mixin classes) • What purpose ABS server • You can use, class abs.ABC. abc module provides the metaclass ABCMeta for defining ABCs and a helper class ABC to alternatively define ABCs through inheritance. Please refer to https://docs.python.org/3/library/abc.html • You can use Python collections module (collections.abc) that has a reach collection of mixins. This is a “Myth of the 10X Programmer”. Can very easily implement different protocols like Sequence, Set, Mapping, Iterator, and many more. Please refer to https://docs.python.org/3/library/collections.abc.html • Example of Usage of Abstract Base Class: · Data Validation framework: https://docs.python.org/3/howto/descriptor.html#complete-practical-example · BitSet provides memory-efficiency · FileDict is a dictionary that is sharable between processes and can be inspected externally while a program is running. · SQLDict. This dictionary variant uses a database as the underlying store. Allows sharing the dictionary.