multimethod
A callable directed acyclic graph of methods.
Usage
multimethod(func)Attributes
| Name | Description |
|---|---|
| docstring | a descriptive docstring of all registered functions |
docstring
a descriptive docstring of all registered functions
docstring
Methods
| Name | Description |
|---|---|
| __call__() | Resolve and dispatch to best method. |
| __missing__() | Find and cache the next applicable method of given types. |
| clean() | Empty the cache. |
| copy() | Return a new multimethod with the same methods. |
| evaluate() | Evaluate any pending forward references. |
| parents() | Find immediate parents of potential key. |
| register() | Decorator for registering a function. |
| select() | Return the next applicable method of given types, or raise DispatchError. |
__call__()
Resolve and dispatch to best method.
Usage
__call__(*args, **kwargs)__missing__()
Find and cache the next applicable method of given types.
Usage
__missing__(types)clean()
Empty the cache.
Usage
clean()copy()
Return a new multimethod with the same methods.
Usage
copy()evaluate()
Evaluate any pending forward references.
Usage
evaluate()parents()
Find immediate parents of potential key.
Usage
parents(types)register()
Decorator for registering a function.
Usage
register(self, __func: REGISTERED) -> REGISTERED
register(self, args: type = ()) -> Callable[[REGISTERED], REGISTERED]Optionally call with types to return a decorator for unannotated functions.
select()
Return the next applicable method of given types, or raise DispatchError.
Usage
select(types, keys)Provisional: override to customize ambiguity resolution.
Parameters
types-
the types to dispatch on keys: the most specific matching signatures, with no strict precedence