Search⌘ K
AI Features

Case Study

Explore how to apply abstract base classes, operator overloading, and data partitioning in a Python case study. Learn to extend built-in types with type hints and create specialized collections for OOP projects.

We’ll refine our case study in this chapter. Previously, in the “Objects in Python” chapter, we talked in a vague way about loading the training data and splitting it into two clumps—the training set and the testing set. In the “When to Use Object-Oriented Programming” chapter, we looked at ways to deserialize the source file into Sample instances.

In this chapter, we want to look further at this operation of using the raw data to create a number of TrainingKnownSample instances ...