Jargon: Polymorphism, dispatch, overloading, duck typing (2026)

By Xah Lee. Date: .

Polymorphism

polymorphism 2026-11-24 1c1a2 L
polymorphism 2026-11-24 1c1a2 L

polymophism, as the term is understood in computer science, is the most idiotic thing.

the gist of the problem is that, the meaning seems to have derived from implementation of programing language perspective, not a programing language user concept.

normally, we might think polymorphism means the lang has a feature of easy way to write functions that do diff things depending on arg count and type.

but in reality, for example in java,

myDog.makeSound()

myCat.makeSound()

is considered true polymorphism. called subtype polymorphism.

they think it's polymorphism because the method “makeSound” behaves differently yet the name is identical.

but, its idiotic because the myDog and myCat can be thought of as namespaces, or, they are different classes, different types, so their makeSound is really not the same function, rather, functions with different names or from different places. You wouldnt expect two functions both named f to behave the same when they came from different libraries?

what a extreme idiocy.

polymorphism 2026-11-23 3386a L
polymorphism 2026-11-23 3386a L
polymorphism 2026-11-23 33802 L
polymorphism 2026-11-23 33802 L

Compile time polymorphism

polymorphism 2026-11-23 3464d L
polymorphism 2026-11-23 3464d L

what i think is true polymorphism, is what usually called compile time polymorphism.

but thats silly, because many high-level langs are not compiled, such as wolfram lang.

the polymorphism jargon is itself extremely idiotic. an obscuratism.

rather, the situation is similar to the situation of the jargon closure, polymorphism should be just called well-designed lang. lol.

how is it possible, for any idiot, to not understand, when a function have different count or type of args, it should naturally behave differently?

which idiot thought, “nah, we not gonna do that cuz its more work.”? (answer: the c idiots.)

Dispatch

also, the “dispatch” word, is the most idiotic and offensive. (fuck common lispers)

because, with that, it induces a time-based thinking, like the term instance and binding.

Duck typing

another most offensive related term is “duck typing”.

fuck the milengen dolts that popularized the term around 2008, in python and ruby.

garbage-collection, closure, first class citizen

the c fuckheads, indirectly spread the term, just like the jargon “garbage-collection” and “closure”. Natural features begotten dramatic names, because the brain dead c idiots cant do.

btw, another similar situation is the jargon "first class citizen". 1st spread by scheme lisp.

Do python support function polymorphism

(ai answer) 2026-03-26

Yes and no — Python supports polymorphism, but not in the same way as Java, C++, or C# do.

Python uses a very different (and more flexible) kind of polymorphism.

Here's a clear comparison:

Style Name in Python community Supported in Python? Example languages How it works in Python
Same method name, different parameter types/count Ad-hoc / function overloading No (natively) C++, Java, C# Not directly — Python has only one function body per name
Same method name, different behavior depending on object type Subtype / inclusion polymorphism Yes (very strongly) Java, C++, Python, etc Classic inheritance + method overriding
Same function works on many types because they "look" the same Duck typing / structural polymorphism Yes — Python's main style Python, Ruby, JS "If it walks like a duck and quacks like a duck…"
Generic functions (dispatch on argument types) Multiple dispatch Yes (but not built-in) Julia, Common Lisp Via @singledispatch or third-party libs

Quick examples – all four kinds

  1. Classic OOP polymorphism (fully supported)
class Dog:
    def speak(self):
        return "woof"

class Cat:
    def speak(self):
        return "meow"

def make_it_speak(animal):
    print(animal.speak())     # ← polymorphism happens here

make_it_speak(Dog())   # woof
make_it_speak(Cat())   # meow
  1. Duck typing (Python's favorite flavor)
def print_length(thing):
    print(len(thing))          # works on ANYthing that has .__len__()

print_length("hello")      # 5
print_length([10,20,30])   # 3
print_length({"a":1, "b":2}) # 2
# print_length(999)        # TypeError – no len()
  1. No traditional function overloading
def add(a, b):
    return a + b

# This does NOT work — second definition just replaces the first
def add(a, b, c):
    return a + b + c
  1. Single dispatch (closest thing to overloading – Python 3.4+)
from functools import singledispatch

@singledispatch
def show(x):
    print(f"Other: {x}")

@show.register(int)
def _(x):
    print(f"Integer: {x}")

@show.register(str)
def _(x):
    print(f"String: {x!r}")

show(3.14)      # Other: 3.14
show(42)        # Integer: 42
show("xyz")     # String: 'xyz'

Bottom line – most common answers

Question Short answer
Does Python support polymorphism? Yes, very much so
Does Python support function overloading like C++/Java? No
Does Python support duck typing polymorphism? Yes — that's the main style
Can you do type-based dispatch? Yes — with @singledispatch or libraries (multipledispatch, overload, functools.singledispatchmethod)

So in practice:
Python → very strong polymorphism, just not the C++/Java kind.

You usually don't miss traditional overloading once you get used to duck typing + singledispatch + default arguments + *args / **kwargs. 😄

show a simple example of polymorphism in Java

Here’s a simple example of runtime polymorphism in Java (the most common and important kind):

// Parent class
class Animal {
    void makeSound() {
        System.out.println("Some generic animal sound");
    }
}

// Child classes that override the method
class Dog extends Animal {
    @Override
    void makeSound() {
        System.out.println("Woof!");
    }
}

class Cat extends Animal {
    @Override
    void makeSound() {
        System.out.println("Meow!");
    }
}

public class Main {
    public static void main(String[] args) {
        // Reference type is Animal, actual object type is Dog/Cat
        Animal myDog = new Dog();
        Animal myCat = new Cat();

        // The correct method is called at runtime
        myDog.makeSound();   // Output: Woof!
        myCat.makeSound();   // Output: Meow!
    }
}

What’s happening

This is the classic subtype polymorphism that Java (and many other OOP languages) support, and it’s the kind Python also supports through inheritance + method overriding.

that doesn't seem to count because it's really the class that's checking the type

The previous example does count as polymorphism. Here's why the distinction matters:

What is not polymorphism (manual type checking)

void makeSound(Animal animal) {
    if (animal instanceof Dog) {
        System.out.println("Woof!");
    } else if (animal instanceof Cat) {
        System.out.println("Meow!");
    }
}

Here the function itself is inspecting the type and deciding what to do. That's just an if-else chain.

What is polymorphism (dynamic dispatch)

Animal a = new Dog();
a.makeSound();   // no type check here

The call site does not inspect the type. The JVM looks at the actual runtime type of the object and jumps to the correct method automatically (via a vtable). That's the definition of runtime polymorphism.

You can pass any subtype and the correct behavior happens without the calling code knowing or caring which concrete class it is. That is polymorphism.


If you mean function overloading (compile-time polymorphism)

This is the other classic form, and it is based on argument types at compile time:

class MathUtils {
    int add(int a, int b) {
        return a + b;
    }

    double add(double a, double b) {
        return a + b;
    }

    int add(int a, int b, int c) {
        return a + b + c;
    }
}

public class Main {
    public static void main(String[] args) {
        MathUtils m = new MathUtils();
        System.out.println(m.add(2, 3));       // 5
        System.out.println(m.add(2.5, 3.5));   // 6.0
        System.out.println(m.add(1, 2, 3));    // 6
    }
}

Same method name, different parameter lists. The compiler chooses which version to call based on the argument types. This is sometimes called "function polymorphism" or ad-hoc polymorphism.


Summary

Kind Based on Manual checks? Example above
Runtime polymorphism Object's actual class No Animal/Dog/Cat
Compile-time polymorphism Argument types No (compiler) add() overloading
Manual type testing if / instanceof Yes Not polymorphism

The first example I showed is the standard, textbook form of polymorphism in Java. The second is the overloading form. Both are real; the manual instanceof version is not.