Need help with Python scoping rules

Carl Banks pavlovevidence at
Wed Aug 26 18:13:40 CEST 2009

On Aug 26, 8:36 am, kj <no.em... at> wrote:
> In <1bf83a7e-f9eb-46ff-84fe-cf42d9608... at> Carl Banks <pavlovevide... at> writes:
> >Yeah, it's a little surprising that you can't access class scope from
> >a function, but that has nothing to do with encapsulation.
> It does: it thwarts encapsulation.  The helper function in my
> example is one that clearly rightfully belongs nowhere else than
> the class itself, i.e. encapsulated within the class. It is only
> this silly prohibition against recursive functions in a class
> statement that forces one to put it outside the class statement.

Oh well, I guess that sucks for you.

Carl Banks

More information about the Python-list mailing list