improve this newbie code/nested functions in Python?

Esmail ebonak at
Fri Mar 20 22:10:50 CET 2009

> To make a closure, the inner function *must* be nested in the outer.
> To be an instance method, a function *must* be a class attribute, and
> the easier way to indicate that is by nesting.
> In this case, the client does *not* use the other two classes, so the
> nesting is misleading.  I think the only time a class *might* be nested
> is when it is used by and only (directly) used by whatever it is nested
> in -- and even then, nesting is not necessary.  A class statement can
> only use global and class local names and not the non-global names in
> the surrounding context.

Thanks Terry, you've gotten me something to ponder.


More information about the Python-list mailing list