libb.multimethod
- multimethod(*types)[source]
Decorator for type-based method dispatch (multiple dispatch).
Register function overloads that dispatch based on argument types.
- Parameters:
types – Type(s) to match for this overload.
- Returns:
Decorator that registers the function with MultiMethod.
Example:
>>> @multimethod(int, int) ... def foo(a, b): ... return a + b >>> @multimethod(str, str) ... def foo(a, b): ... return a + ' ' + b