EDIT: don't read on. i forgot self.
since i needed a member function, i found this on the internet:
since i needed a member function, i found this on the internet:
def method_dispatch(func): dispatcher = singledispatch(func) def wrapper(*args, **kwargs): return dispatcher.dispatch(args[1].__class__)(*args, **kwargs) wrapper.register = dispatcher.register update_wrapper(wrapper, func) return wrapperthen:
@method_dispatch def do_work(self, info): pass @call.register(type1) def _(self, param): return do_work(param) @call.register(str) def _(self, param): # do workas you can see i'm calling an overload from another one, but i get "undefined variable" on that call. how should i call it?