Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing evaluate() to multidispatch.__call__() #130

Merged
merged 2 commits into from
Jan 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion multimethod/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ def __missing__(self, types: tuple) -> Callable:
return self.setdefault(types, self.select(types, self.parents(types)))

def dispatch(self, *args) -> Callable:
self.evaluate()
types = tuple(map(type, args))
if not any(map(issubclass, types, self.generics)):
return self[types]
Expand All @@ -343,7 +344,6 @@ def dispatch(self, *args) -> Callable:

def __call__(self, *args, **kwargs):
"""Resolve and dispatch to best method."""
self.evaluate()
func = self.dispatch(*args)
try:
return func(*args, **kwargs)
Expand Down
Loading