July 2020
Beginner to intermediate
822 pages
20h 28m
English
In Chapter 7, Basics of Classes and Objects, we looked at some recipes that covered the basics of class design. In this chapter, we'll dive more deeply into Python classes.
In the Designing classes with lots of processing and Using properties for lazy attributes recipes in Chapter 7, Basics of Classes and Objects, we identified a design choice that's central to object-oriented programming, the "wrap versus extend" decision. One way to add features is to create a new subclass via an extension. The other technique for adding features is to wrap an existing class, making it part of a new class.
In addition to direct inheritance, there are some other class extension techniques available in Python. A Python class can ...
Read now
Unlock full access