Understanding Python class

Brett Cole
The Startup
Published in
7 min readNov 12, 2019

--

The thought behind classes in most programming languages is universal. However, the structure of the class itself is what may change between languages. Even Javascript with ECMAScript 2015 saw fit to include classes, but really we all know that is a bunch of syntactic sugar.

If you can understand classes in one programming language, then in a relatively short period of time you will grasp classes in a different language.

You have probably heard this before, but the easiest way to think of a class is to look at it like a blueprint.

But a blueprint for what you might ask? We use a Python class to create an object. Everything in Python is basically considered an object. This class could represent a dog, a car, or taking multiple objects and combining them. Doing so is considered composition which we won’t be speaking much about in this particular article. We as developers get to create whatever blueprint we deem necessary.

No worries don’t feel overwhelmed, we will consider examples along the way to really drive the point home.

Creating A Class

We’ve learned that a class is used to create an object. Does that mean our class can only be used to create one individual object only? That is where the term instance comes into play. When we use our class to create an…

--

--