File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -472,7 +472,8 @@ def _format_method(method): # Taking a page from Julia and some artistic libert
472472 source , firstlineno = inspect .getsourcelines (function )
473473 return f"{ thecallable .__qualname__ } { str (thesignature )} from { filename } :{ firstlineno } "
474474
475- def _find_matching_multimethod (dispatcher , args , kwargs ):
475+ # Find the first matching multimethod that is registered on `dispatcher`.
476+ def _resolve_multimethod (dispatcher , args , kwargs ):
476477 multimethods = _list_multimethods (dispatcher , _extract_self_or_cls (dispatcher , args ))
477478 for thecallable , type_signature in multimethods :
478479 try :
@@ -554,7 +555,7 @@ def _setup(fullname, multimethod):
554555 # Create the dispatcher. This will replace the original function.
555556 @wraps (multimethod )
556557 def dispatcher (* args , ** kwargs ):
557- thecallable = _find_matching_multimethod (dispatcher , args , kwargs )
558+ thecallable = _resolve_multimethod (dispatcher , args , kwargs )
558559 if thecallable :
559560 return thecallable (* args , ** kwargs )
560561 _raise_multiple_dispatch_error (dispatcher , args , kwargs ,
Original file line number Diff line number Diff line change 2121
2222from .arity import arities , resolve_bindings , tuplify_bindings , UnknownArity
2323from .fold import reducel
24- from .dispatch import isgeneric , _find_matching_multimethod
24+ from .dispatch import isgeneric , _resolve_multimethod
2525from .dynassign import dyn , make_dynvar
2626from .regutil import register_decorator
2727from .symbol import sym
@@ -223,7 +223,7 @@ def curried(*args, **kwargs):
223223 nargs = len (args )
224224 if (nargs < min_arity or
225225 (isgeneric (f ) == "generic" and min_arity <= nargs <= max_arity and
226- not _find_matching_multimethod (f , args , kwargs ))):
226+ not _resolve_multimethod (f , args , kwargs ))):
227227 p = partial (f , * args , ** kwargs )
228228 if islazy (f ):
229229 p = passthrough_lazy_args (p )
You can’t perform that action at this time.
0 commit comments