class inheretence of a attribute which is itself a class
Posted
by alex
on Stack Overflow
See other posts from Stack Overflow
or by alex
Published on 2010-05-07T21:19:47Z
Indexed on
2010/05/07
21:48 UTC
Read the original article
Hit count: 262
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?
© Stack Overflow or respective owner