10. Object-Oriented Programming

In this chapter, we will briefly look at object-oriented programming, or OOP for short. OOP is a methodology for organizing programs that encourages careful design and code reuse. Most modern programming languages support it, and it is has proved to be a practical way to structure and create large programs.

Essentially, an object is a collection of data, and functions that operate on that data. We’ve already been using objects in Python; numbers, strings, lists, dictionaries, and functions are all examples of objects.

To create new kinds of objects, you must first create a class ...

Get Python: Visual QuickStart Guide, Third Edition 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.