multimethod

A callable directed acyclic graph of methods.

Usage

Source

multimethod()

Attributes

Name Description
__name__ str(object=’’) -> str
docstring a descriptive docstring of all registered functions

__name__

str(object=’’) -> str

name: str

str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.


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.

__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.