In this chapter, we will focus on modern syntax elements of Python with regard to classes and object-oriented programming. However, we will not cover the topic of object-oriented design patterns, as they will be discussed in detail in Chapter 17, Useful Design Patterns. Here, we will perform an overview of the most advanced Python syntax elements that will allow you to improve the code of your classes.
The Python class model as we know it evolved greatly during the history of Python 2. For a long time, we lived in a world where two implementations of the object-oriented programming paradigm coexisted in the same language. These two models were simply referred to as old-style and new-style classes. Python 3 ended this dichotomy, so that only the model known as the new-style class is available to developers. It is still important to...