plum
plum copied to clipboard
init fails, incorrect number of arguments
Try this code
from plum import dispatch
class A:
@dispatch
def __init__(self):
self.__init__(1)
@dispatch
def __init__(self, x:int):
print(str(x))
class B(A):
def __init__(self):
super().__init__()
B()
Expected: B is constructed with default value 1
Actual:
TypeError: __init__() takes 1 positional argument but 2 were given
I'm not sure what is going on as constructing A() works fine.
Note the print is just for clarity, normally some field initialization would happen there.