I have no class

Chris Angelico rosuav at gmail.com
Sun Nov 23 17:59:24 CET 2014

On Mon, Nov 24, 2014 at 3:49 AM, Seymore4Head
<Seymore4Head at hotmail.invalid> wrote:
> Like I have said, most of the stuff I am doing is still trial and
> error.  Having to specify RPS to use it inside the class seemed wrong
> to me.
> I haven't read enough about classes yet to know what the correct way
> is yet.

That's because Python doesn't really do the whole "infinitely-nested
scopes" thing that you see in C-like languages. (That kind of scoping
doesn't really work without declared variables, which is completely
against the Python model.) So you have to be a bit more explicit about
where you want to reference things from. What you can do is use 'self'
instead of the class name; that's often the cleanest way to do it.


More information about the Python-list mailing list