Need help with Python scoping rules

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


On Aug 26, 8:36 am, kj <no.em... at please.post> wrote:
> In <1bf83a7e-f9eb-46ff-84fe-cf42d9608... at j21g2000yqe.googlegroups.com> Carl Banks <pavlovevide... at gmail.com> 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