Reputation: 1269
I am using Python 2.6.6.
I have narrowed down my faulty code to these 2 classes:
class Graph(object):
def __init__(self, name):
self.name = name
self.testme = 3
and
class StepPlot(Graph):
def __init__(self, name):
print("fdasfdsf")
print(dir(super(Graph, self)))
super(Graph, self).__init__(name)
Unfortunately, when I instantiate a StepPlot
with StepPlot('fdsfa')
, I get the error
TypeError: object.__init__() takes no parameters
Shouldn't it be able to take one parameter?
Looking at
When to call Python's super().__init__()?
This class organization should work.
Am I missing something fundamentally? Any help would be appreciated.
Upvotes: 5
Views: 214
Reputation:
The first argument to super
should be the class from which it is called:
super(StepPlot, self).__init__(name)
For more information, here is a link to the documentation.
Upvotes: 4