Re: Nested inner classes and inheritance -> namespace problem

2011-04-13 Thread Larry Hastings
On 04/13/2011 07:37 PM, Eric Snow wrote: I suppose you could try something like this: class Outer: global Inner class Inner: class Worker: pass class InnerSubclass(Inner): class Worker(Inner.Worker): pass However, that pollutes your global namespace. If you are worr

Re: Nested inner classes and inheritance -> namespace problem

2011-04-13 Thread Eric Snow
On Wed, Apr 13, 2011 at 3:12 AM, Larry Hastings wrote: > > The problem: if you're currently in a nested class, you can't look up > variables in the outer "class scope". > > For example, this code fails in Python 3: > > class Outer: > class Inner: > class Worker: > pass > > class Inn

Re: Nested inner classes and inheritance -> namespace problem

2011-04-13 Thread Jean-Michel Pichavant
Larry Hastings wrote: The problem: if you're currently in a nested class, you can't look up variables in the outer "class scope". For example, this code fails in Python 3: class Outer: class Inner: class Worker: pass class InnerSubclass(Inner): clas

Re: Nested inner classes and inheritance -> namespace problem

2011-04-13 Thread James Mills
On Wed, Apr 13, 2011 at 7:12 PM, Larry Hastings wrote: > Yes, I could make the problem go away if I didn't have nested inner classes > like this.  But I like this structure.  Any idea how I can make it work > while preserving the nesting and inheritance? It's probably better to make use of module

Nested inner classes and inheritance -> namespace problem

2011-04-13 Thread Larry Hastings
The problem: if you're currently in a nested class, you can't look up variables in the outer "class scope". For example, this code fails in Python 3: class Outer: class Inner: class Worker: pass class InnerSubclass(Inner): class Worker(Inner.Worker):