Chapter 14. Objects
In the last few chapters, we’ve been looking at different ways of organizing data and programs and collecting things together. We have seen that lists are a way to collect variables (data) together, and functions are a way to collect some code together into a unit that you can use over and over again.
Objects take the idea of collecting things together one step further. Objects are a way to collect functions and data together. This is a very useful idea in programming, and it’s used in many, many programs. In fact, if you look under the hood in Python, almost everything is an object. In programming terms, we say Python is object oriented. That means that it’s possible (in fact, quite easy) to use objects in Python. It isn’t necessary to create your own objects, but it makes many things easier.

In this chapter, we’ll learn what objects are and how to create and use them. In later chapters, when we start doing graphics, we’ll be using objects a lot.
What’s an object? If we were not talking about programming, and I asked you that question, we might have a conversation like this:

That’s a good start at defining what an object is in Python, too. Take a ball, for example. You can do things to a ball, like pick it up, throw it, kick it, or inflate it (for some balls). We call these actions. You can also describe a ball by telling me its color, size, and weight. These are attributes of a ball.