Functions let you reuse behavior, but object-oriented programming lets you bundle behavior and data together. This module covers how to model real-world entities as classes — the foundation of most large Python codebases and frameworks.
It starts with classes and instances: defining a
class, creating objects from it, and giving each instance its own
attributes. From there it covers inheritance,
for building subclasses that extend or override a parent class's
behavior. It continues with special (magic/dunder)
methods like __init__ and __repr__,
which let your objects work with Python's built-in syntax, and
closes with property decorators for writing
clean getters, setters, and deleters.
Watch the lessons in order, then continue on to Files, Exceptions & Errors.
Creating and using classes in Python, and how classes let you logically group data and functions together.
Creating subclasses that inherit attributes and methods from a parent class, and overriding behavior where needed.
Using special methods like __repr__ and __str__ to customize how your objects behave with built-in Python functions and operators.
Using the @property decorator to write clean getters, setters, and deleters for managing an object's attributes.