Image credit: https://www.pexels.com/@startup-stock-photos

Member-only story

How to Effectively Use Python Classes

Richard Quinn
11 min readMay 18, 2020

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.

--

--

Richard Quinn
Richard Quinn

Written by Richard Quinn

I am a software engineering manager with over 25 years of experience. I am working to improve people’s health. Based in Basel, Switzerland.

No responses yet