Let’s explore the powerful object-oriented programming concepts available to us in Python!
This article is part of the course “Object-Oriented Python — for Beginners”. If you’re looking for a more beginner-oriented “Introduction to Python” course, I created one just for you! This course takes things a step further and delves deep into object-oriented Python. Earlier we saw how the tuple
data type is used to create a record. The class
can do the same, but it also allows us to bundle functions alongside the data.
Python is an object-based programming language. Every data type, and every variable, is an object. But Python does not require us to use the object-oriented programming paradigm, we’ve done just fine so far without writing any classes.
Writing Classes in Python
Object-oriented programming has its own vocabulary which you’ll need to become familiar with:
- Class: a class is the computer code which defines the blueprint for objects. A class is a piece of code, often quite complex, written by a programmer like you.
Let’s define a class
called Book
.