Class model and object-oriented programming
The most prevalent paradigm of Python is object-oriented programming (also known as OOP). It is centered around objects that encapsulate data (in the form of object attributes) and behavior (in the form of methods). OOP is probably one of the most diverse paradigms. It has many styles, flavors, and implementations that have been developed over many years of programming history. Python takes inspiration from many other languages, so in this section, we will take a look at the implementation of OOP in Python through the prism of different languages.
To facilitate code reuse, extensibility, and modularity, OOP languages usually provide a means for either class composition or inheritance. Python is no different and like many other object-oriented languages supports the subclassing of types.
Python may not have as many object-oriented features as other OOP languages, but it has a pretty flexible data and class model that allows you to...