In my code, I have the following class:
class A:
@functools.singledispatchmethod
def handle(arg):
pass
I want other class to inherit from A and overload the generic method handle like so:
class B(A):
@handle.register
def handle_int(arg: int):
return arg + 2
However, I get an error:
unresolved reference 'handle'
How can I create this generic method in the base class? (I don't want to create this function in every subclass to use the singledispatchmethod.)