Reputation: 1117
I have a parents class defined as:
class Alpha(X, Y, metaclass=abc.ABCMeta):
def __init__(self, time_series : pandas.Series):
super(Alpha, self).__init__()
And I have its Child Class:
class Beta(Alpha):
def __init__(self, returns: [daily_returns_object]):
super(Beta, self).__init__()
self.calibrate(returns)
I try to create a Beta
Object according to:
#returns_list has been defined but is irrelevant here
beta_obj = Beta(returns_list)
I get the error TypeError:__init__() missing one positional argument: 'time_series'
. Hence, I wrote beta_obj = Beta(time_series, returns_list)
but then get the error TypeError:__init__() takes 2 positional arguments but 3 were given
.
Upvotes: 0
Views: 133
Reputation: 1122092
You are calling the Alpha.__init__
method here:
super(Beta, self).__init__()
but you are not passing in the required time_series
argument there.
If that's an argument that Beta
takes too, you'll need to add it to your Beta.__init__
definition, then pass it on:
class Beta(Alpha):
def __init__(self, time_series: pandas.Series, returns: [daily_returns_object]):
super(Beta, self).__init__(time_series)
self.calibrate(returns)
Upvotes: 1