RE: Why nested scope rules do not apply to inner Class?

2008-08-13 Thread Cousson, Benoit
> > There is no point of nested classes because nested classes _are not_ > supported by python. They are simply an artifact of not actively > denying the syntax non-globally. I would fully support a change to the > language to actively forbid a class definition that is not > module-level. > > > I

RE: Why nested scope rules do not apply to inner Class?

2008-08-13 Thread Cousson, Benoit
> Defining it as a nested class saves you one line > of code, but IMHO makes the result just a bit more cluttered, while > reducing the elegance of reusing the metaclass. The whole point of nested class is to avoid polluting the namespace with classes that are only used locally. So the argument a

RE: Why nested scope rules do not apply to inner Class?

2008-08-12 Thread Cousson, Benoit
> This is a language limitation. > This is because nested scope is implemented for python function only since > 2.3 > allow late binding of free variables. the scope in class statment is not a > closure, so there is only two possible scope in it : local and global. That was my understanding as wel

Why nested scope rules do not apply to inner Class?

2008-08-12 Thread Cousson, Benoit
Hi, I'd like to be able to use a nested class (C1) from another sibling nested class (C3). This looks very similar to the nested scopes of functions except that it does not work. class A(object): pass class B(object): class C1(object): pass cla