Replies: 1 comment 2 replies
-
Should also add there is a current solution: explicitly register the methods. class A:
def f(self, x):
return "fallback"
class B(A):
f = multimethod(A.f)
@multimethod
def f(self, x: int):
return x |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Plum's comparison with
multimethod
cites this example:A normal method dispatches based on its presence, not on its arguments. So to me this is ambiguous, and a reason to use
multimethod
functions instead of methods. The ambiguity comes from whether one pictures the dispatch occurring "twice", once onself
and then again on all the args.But it could be trivially supported, and backwards-compatible (assuming no one was relying on the dispatch error). So opening it up for discussion.
1 vote ·
Beta Was this translation helpful? Give feedback.
All reactions