
Untitled
By: a guest on
Jun 16th, 2012 | syntax:
None | size: 0.59 KB | hits: 16 | expires: Never
Python: 'super' object has no attribute 'attribute_name'
class Parent(object):
def __init__(self, value):
self.some_var = value
class Child(Parent):
def __init__(self, value):
super(Child, self).__init__(value)
def doSomething(self):
parent_var = super(Child, self).some_var
obj = Child(123)
obj.doSomething()
Traceback (most recent call last):
File "test.py", line 13, in <module>
obj.doSomething()
File "test.py", line 10, in doSomething
parent_var = super(Child, self).some_var
AttributeError: 'super' object has no attribute 'some_var'