multimethod

A callable directed acyclic graph of methods.

Usage

Source

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

Source

__call__(*args, **kwargs)

__missing__()

Find and cache the next applicable method of given types.

Usage

Source

__missing__(types)

clean()

Empty the cache.

Usage

Source

clean()

copy()

Return a new multimethod with the same methods.

Usage

Source

copy()

evaluate()

Evaluate any pending forward references.

Usage

Source

evaluate()

parents()

Find immediate parents of potential key.

Usage

Source

parents(types)

register()

Decorator for registering a function.

Usage

Source

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

Source

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