Duck Typing

By Ayanami Kaine | Created on January 27, 2026 | Edited on January 27, 2026
FundamentalsTypes

If it quacks like a duck it’s a duck. Duck typing is the simple term for when two objects have the same behavior they are in the context the same.

class Beetle():

    def __init__(self):
        self.is_driving = False;
        self.name = "Beetle"

    def drive(self):
        self.is_driving = True

    def quack(self):
        print("Brummm Brumm")

class Duck():

    def __init__(self):
        self.is_driving = False;
        self.name = "Duck"

    def quack(self):
        print("Quack")


duck = Duck()
bettle = Beetle()

duck.quack()
bettle.quack()

It doesn’t matter if our Beetle car can drive when it can quack it’s a duck.