3 Mental Models of Objects and the Meaning of “self”

Hopefully the new concepts and terminology I’ve introduced so far are starting to make sense. Some people new to OOP have trouble envisioning what an object is and how the methods of an object work with its instance variables. The specifics are fairly complex, so it can be helpful to develop a mental model of how objects and classes operate.

In this chapter, I’ll present two mental models of OOP. Right up front, I want to be clear that neither of these models is an exact representation of how objects work in Python. Instead, these models are intended to give you a way to think about what ...

Get Object-Oriented Python 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.