Python · September 2026

Understanding __init__ and self in Python

When I first started working with Python classes, two things that seemed particularly confusing were __init__ and self. This is my attempt to explain what I've learned in simple terms.

What is a class?

A class can be thought of as a blueprint for creating objects. It describes what information an object should contain and what it can do.

For example, we could create a Bike class:

class Bike:
    pass

What is __init__?

The __init__ method is called when we create a new instance of a class. It allows us to give the new object its initial information.

class Bike:

    def __init__(self, colour, frame_material):
        self.colour = colour
        self.frame_material = frame_material

What is self?

self refers to the particular object that is currently being worked with.

For example, if we create two bikes:

red_bike = Bike("Red", "Carbon Fiber")
blue_bike = Bike("Blue", "Aluminium")

Python can keep the information for each bike separate. The red bike has its own colour and frame material, while the blue bike has its own values.

Creating an instance

When we create red_bike, we are creating an instance of the Bike class.

The class is the blueprint. The instance is an actual object created using that blueprint.

What I'm taking away from this

The most useful way I've found to think about it is:

I'm still developing my understanding of object-oriented programming, but thinking about these concepts in terms of objects and blueprints has made them much easier to understand.

← Back to Learning & Development