Abstract Base Class
Jump to navigation
Jump to search
An Abstract Base Class is a base class for a data structure.
- AKA: ABC.
- See: Virtual Subclass, Iterable Structure.
References
2013
- http://docs.python.org/2/glossary.html#term-abstract-base-class
- Abstract base classes complement duck-typing by providing a way to define interfaces when other techniques like hasattr() would be clumsy or subtly wrong (for example with magic methods). ABCs introduce virtual subclasses, which are classes that don’t inherit from a class but are still recognized by isinstance() and issubclass(); see the abc module documentation. Python comes with many built-in ABCs for data structures (in the collections module), numbers (in the numbers module), and streams (in the io module). You can create your own ABCs with the abc module.