CHAPTER 10

image

Classes

Classes are the way that we create objects. We use objects to try to model the real world in computer code. Objects are a way of encapsulating programming code that, not only can be reusable, but can be duplicated and modified without affecting the original object. Objects often have attributes and functions to modify those attributes. Classes also allow you to write a group of code that may be used in multiple projects without rewriting or copying the code into each project just like a library. We will concentrate on objects in this chapter, all though the concepts are the same for simple classes.

What is an object?

When trying ...

Get The Python Quick Syntax Reference 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.