Object Oriented Programming in Python

Lessons in this section

  1. Classes

    Classes and objects, attributes and methods, self, the constructor, access modifiers and name mangling, class and static methods, and Enum.

  2. Inheritance

    Parent and child classes, the five types of inheritance, inheriting and overriding, super(), and isinstance() and issubclass().

  3. Polymorphism

    One name and many behaviours: method overriding, why Python has no overloading, dynamic binding, and operator overloading with magic methods.

  4. Abstraction

    Hiding how something works behind what it does, abstract classes with the abc module, and abstract methods every child must implement.

  5. Encapsulation

    Keeping data inside the class: data hiding, getters and setters, validation, and why Python uses @property instead.

  6. Advanced OOP

    Inner classes, data classes with @dataclass, and the magic methods that make your objects work with print(), len(), in and for.