Pyenos <[EMAIL PROTECTED]> writes: > Thanks for clarifying the definitions of nested class and > subclass. However, it did not solve my original problem, and I have > redefined my question: > > class Class1: > class Class2: > class Class3: > def __init__(self): > self.var="var" > class Class4: > print Class1.Class2.Class3.var > > This code gives me the error: > Traceback (most recent call last): > File "<stdin>", line 1, in ? > File "<stdin>", line 2, in Class1 > File "<stdin>", line 3, in Class2 > File "<stdin>", line 6, in Class3 > File "<stdin>", line 7, in Class4 > NameError: name 'Class1' is not defined > > I have tried: > > class Class1: > class Class2: > def __init__(self): > var="var" > print Class1.Class2().var #this works > > And, this worked. It is very strange that nested loop somehow fails to > work when the innermost class has indentation level greater than two.
I found this link which is relevent: http://mail.python.org/pipermail/python-list/2003-April/198978.html -- http://mail.python.org/mailman/listinfo/python-list