Chapter 6
Doing Python with Class
IN THIS CHAPTER
Mastering classes and objects
Creating a class
Initializing an object in a class
Populating an object’s attributes
Giving a class methods
Understanding class inheritance
In the previous 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 oversold things a little there). But classes have become a defining characteristic of modern object-oriented programming languages like Python.
We’re aware we threw a whole lot of techno jargon your way in the previous chapters. Don’t worry. For the rest of this chapter we start off assuming that — like 99.9 percent of people in this world — you don’t know a class ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access