6 ms·
I've always heard them referred to as "Generic Functions", though the Wikipedia article is annoying opaque. The important quality (in my practical understandin
by dschoon 15y ago
I've always heard them referred to as "Generic Functions", though the Wikipedia article is annoying opaque.
The important quality (in my practical understanding) is that a generic function's specialization is decoupled from the object system -- delegating to `x.__iter__()` doesn't require `x` inheriting a method from a parent; the process `iter(x)` uses to delegate might not even require any type information about `x` at all.