OOP

Object-oriented programming concepts: classes, objects, inheritance, encapsulation, and polymorphism.

Python: Operator Overloading and Custom Object Behavior

Learn Python operator overloading with __add__, __sub__, __mul__, __eq__, and reverse operators. Build a Vector class that supports arithmetic, comparison, and string operations using magic methods. “Simple things should be simple, complex things should be possible.” Alan Kay, ACM Queue Last Updated: July 2026 | Tested on: Python 3.14.6 | Difficulty: Intermediate | Reading Time: 11 minutes Writing v1.add(v2) feels clunky when you could just write v1 + v2. Python operator overloading lets you decide what +, -, *, ==, ... Read More

Python: Multiple Inheritance & MRO

Python multiple inheritance lets one class inherit from several parents at once. This guide explains the diamond problem, Method Resolution Order (MRO), C3 linearization, and how Python decides which method actually runs. “Everyone knows that debugging is twice as hard as writing a program in the first place.” Brian Kernighan, The Elements of Programming Style Last Updated: July 2026 | Tested on: Python 3.14.6 | Difficulty: Intermediate | Reading Time: 13 minutes Prerequisites: Inheritance Here is the question that breaks ... Read More

Python: Polymorphism, Method Overriding & Duck Typing

Think about the power button on a TV remote, an AC remote, and a car key fob. You press the same button on each one, but a completely different thing happens every time. The TV turns on, the AC starts cooling, the car unlocks. Same action, different result depending on what you are pressing it on. That is Python polymorphism in one picture: one name, many behaviours. “If it walks like a duck and it quacks like a duck, then ... Read More