firstmethod
Multiple dispatch.
Return a function that with a list of instances,
finds the first instance that gives a value for the given method.
The list can also contain lazy instances
(:class:`~kombu.utils.functional.lazy`.)
def firstmethod(
method: string,
on_call: callable = None
) - > function
Multiple dispatch. Return a function that with a list of instances, finds the first instance that gives a value for the given method.
Parameters
| Name | Type | Description |
|---|---|---|
| method | string | The name of the method to look for and invoke on each instance in the provided list. |
| on_call | callable = None | An optional wrapper function used to invoke the found method; receives the method and its arguments. |
Returns
| Type | Description |
|---|---|
function | A matcher function that iterates over objects and returns the first non-None result from the specified method. |