Classes in a class: how to access variables from one in another

Chris Rebert clp2 at
Tue Oct 19 06:22:42 CEST 2010

On Mon, Oct 18, 2010 at 3:24 PM, Steven D'Aprano
<steve at> wrote:
> On Mon, 18 Oct 2010 09:34:07 -0700, Chris Rebert wrote:
>> Also, Python's scoping rules, particularly for class-level scopes, don't
>> work the way programmers from languages where nested classes are common
>> would expect:
> [snip example]
> I'm sorry, I don't see that "language Foo programmers will be surprised
> that Python is not language Foo" is an argument against Python
> programmers using nested classes. Surely it's an argument against writing
> Foo in Python?

Touché; however, Python's semantics here differ so drastically from
most other languages and the construction in question is so rarely
used or useful that anyone who does use it is likely either in the
running for Python language-lawyers-of-the-year or has a vendetta
against polyglot programmers. :-)

Why am I reminded of for-else...
Also, where does one get a Juris Doctor Programmatica?

More information about the Python-list mailing list