Re: I'm having trouble understanding scope of a variable in a subclass

2006-12-28 Thread WaterWalk
Pyenos wrote: > Approach 1: > > class Class1: > class Class2: > def __init__(self):self.variable="variable" > > class Class3: > def method():print Class1().Class2().variable #problem > > Approach 1.1: > > class Class1: > class

Re: I'm having trouble understanding scope of a variable in a subclass

2006-12-28 Thread Gabriel Genellina
At Thursday 28/12/2006 03:18, Pyenos wrote: 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 las

Re: I'm having trouble understanding scope of a variable in a subclass

2006-12-28 Thread Gabriel Genellina
At Thursday 28/12/2006 01:39, Pyenos wrote: class Class1: class Class2(Class1): variable="variable" class Class3(Class2): print Class1().Class2().variable #problem Also, why is this wrong? Again, don't write just "problem"! What

Re: I'm having trouble understanding scope of a variable in a subclass

2006-12-28 Thread Gabriel Genellina
At Thursday 28/12/2006 01:31, Pyenos wrote: class Class3: def method():print Class1.Class2.variable #problem In all your examples, you wrote def method() instead of def method(self). Error messages are usually meaningful, they give you valuable informati

Re: I'm having trouble understanding scope of a variable in a subclass

2006-12-28 Thread Amaury Forgeot d'Arc
Hello, Pyenos a écrit : > 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

Re: I'm having trouble understanding scope of a variable in a subclass

2006-12-27 Thread Pyenos
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): >

Re: I'm having trouble understanding scope of a variable in a subclass

2006-12-27 Thread Pyenos
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:

Re: I'm having trouble understanding scope of a variable in a subclass

2006-12-27 Thread Steven D'Aprano
On Thu, 28 Dec 2006 15:31:26 +1100, Pyenos wrote: > Approach 1: > > class Class1: > class Class2: > def __init__(self):self.variable="variable" > > class Class3: > def method():print Class1().Class2().variable #problem These are NE

Re: I'm having trouble understanding scope of a variable in a subclass

2006-12-27 Thread Pyenos
class Class1: class Class2(Class1): variable="variable" class Class3(Class2): print Class1().Class2().variable #problem Also, why is this wrong? -- http://mail.python.org/mailman/listinfo/python-list

I'm having trouble understanding scope of a variable in a subclass

2006-12-27 Thread Pyenos
Approach 1: class Class1: class Class2: def __init__(self):self.variable="variable" class Class3: def method():print Class1().Class2().variable #problem Approach 1.1: class Class1: class Class2: