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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.