Chapter 6

Doing Python with Class

IN THIS CHAPTER

Bullet Understanding classes and objects

Bullet Learning how to create a class

Bullet Initializing an object in a class

Bullet Populating an object’s attributes

Bullet Discovering how to give a class methods

Bullet Checking out class inheritance

In the preceding chapter, we talk about functions, which allow you to compartmentalize chunks of code that do specific tasks. In this chapter, you learn about classes, which allow you to compartmentalize code and data. You discover all the wonder, majesty, and beauty of classes and objects (okay, maybe we're overselling things a little there). But classes have become a defining characteristic of modern object-oriented programming languages such as Python.

We’re aware we threw a whole lot of techno jargon your way in previous chapters. Don’t worry. For the rest of this chapter, we start off assuming that — like 99.9 percent of people ...

Get Python All-in-One For Dummies, 3rd 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.