class inheretence of a attribute which is itself a class
- by alex
i have a class which inherets a attribute from a super-class. this attribute is a class itself.
class classA(superClass):
def func(self,x):
if self.attributeB is None:
do somthing
and in the other class i have
class superClass:
self.attributB = classB()
i get the error
AttributeError: class classA has no attribute 'attributeB'
when i access the attribute like i showed but if on command line i can see it works,
x = classA()
x.attributeB is None
True
so the test works.
whats going on in the above code?