13.1. Introduction

Before we get into the nitty-gritty of OOP and classes, we begin with a high-level overview, then present some simple examples to get you “warmed up.” If you are new to object-oriented programming, you may wish to merely skim this section first, then begin the formal reading in Section 13.2. This section is targeted more to those already familiar with the concepts, who simply want to see “how it's done” in Python.

The main two entities in Python object-oriented programming are classes and class instances (see Figure 13-1).

Figure 13.1. The factory manufacturing machines on the left are analogous to classes, while each toy produced are instances of their respective classes. Although each instance has the basic underlying structure, ...

Get Core Python Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.