Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'languages.': 0.04; 'yet.': 0.04; 'explicit': 0.07; 'seemed': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '24,': 0.16; 'declared': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:class': 0.16; 'variables,': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'cc:addr:python.org': 0.22; 'specify': 0.24; 'mon,': 0.24; "haven't": 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'correct': 0.29; 'am,': 0.29; "doesn't": 0.30; 'said,': 0.30; 'message-id:@mail.gmail.com': 0.30; 'name;': 0.31; 'class': 0.32; 'stuff': 0.32; 'classes': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'doing': 0.36; 'error.': 0.37; 'wrong': 0.37; 'nov': 0.38; 'enough': 0.39; 'read': 0.60; 'most': 0.60; 'kind': 0.63; 'more': 0.64; '(that': 0.65; 'subject:have': 0.80; 'trial': 0.83; 'to:none': 0.92; 'from.': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=4XyE6sw2UIGQCH/Jswf6fjyFtymUqzb9FX25CrQo0+Q=; b=H+i7ss057yMRKfEgo1ArBkfB4ReMRN//K2zF4KC3YSyBN2Jr9hZX9GoxBp3jB0cXMM W/vydyyGDS7YqN2UhL0D/v5Jun6Vvw7IbWbmMdRbdOXhN0sexQv6zeA2ReSIryDf1bLH IuT4ZziJ11U9m+/y+N7zJZG6g+mSzt5KeD1Qn1HoviTN0tfmPutaeHCKbXz7TC1Cu1xv UMtjG5yZ0fOHKIIYh9+HOxbuHLCw4PZ9NUzGiyYLZCtKcYJ6N1pIajYEVfkR2qjMELCo 6BCEo80iQHysbwFbaiDY1JPRSO50OSE1DUO99Jymw8npfim7SMNjBGAteDBSFviz8oRG wH2g== MIME-Version: 1.0 X-Received: by 10.42.106.12 with SMTP id x12mr21199226ico.26.1416761964241; Sun, 23 Nov 2014 08:59:24 -0800 (PST) In-Reply-To: References: <2qn27adjq412n9nff9kv5jh25d1ekkbncp@4ax.com> <8d047ahkrb4uh4qpq1uk74tel4nfc4s8uv@4ax.com> Date: Mon, 24 Nov 2014 03:59:24 +1100 Subject: Re: I have no class From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1416761966 news.xs4all.nl 2945 [2001:888:2000:d::a6]:41069 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:81389 On Mon, Nov 24, 2014 at 3:49 AM, Seymore4Head 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. ChrisA