Using super() in nested classes
python, super
Solution
I'm not sure why A.B is not working correctly for you, as it should.. Here's some shell output that works:
>>> class A(object):
... class B(object):
... def __init__(self):
... super(A.B, self).__init__()
... def getB(self):
... return A.B()
...
>>> A().getB()
<__main__.B object at 0x100496410>
Problem
Imagine this: ``` class A(object): class B(object): def __init__(self): super(B, self).__init__() ``` This creates an error: ``` NameError: global name B is not defined. ``` I've tried `A.B`, but then it says that `A` is not defined. Update: I've found the problem. I've had a class like this: ``` class A(object): class B(object): def __init__(self): super(B, self).__init__() someattribute = B() ``` In that scope, A isn't defined yet.