Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'broken': 0.03; 'broken.': 0.09; 'convention,': 0.09; 'spelled': 0.09; 'tab': 0.09; 'underscore': 0.09; 'cc:addr:python-list': 0.10; 'wed,': 0.15; 'attributes,': 0.16; 'descriptors': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'metaclasses': 0.16; 'parameter,': 0.16; 'skipped': 0.16; 'wrote:': 0.16; "wouldn't": 0.16; 'wednesday': 0.18; 'cc:2**0': 0.21; 'cc:addr:python.org': 0.21; 'fairly': 0.22; 'function,': 0.22; 'lawrence': 0.22; 'nested': 0.22; 'parsing': 0.22; 'bit': 0.23; '2015': 0.23; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.28; "i'm": 0.29; 'looks': 0.29; 'relies': 0.29; 'function': 0.30; 'classes': 0.30; 'convention': 0.31; 'source': 0.31; 'code': 0.31; 'probably': 0.32; "d'aprano": 0.33; 'steven': 0.33; 'subject:?': 0.34; 'received:google.com': 0.34; 'useful': 0.35; 'but': 0.36; 'being': 0.36; 'there': 0.36; 'subject:" ': 0.36; 'should': 0.37; 'subject:: ': 0.37; 'done.': 0.37; 'ones': 0.38; 'rather': 0.38; 'self': 0.38; 'pm,': 0.39; 'method': 0.39; 'mark': 0.40; 'some': 0.40; 'more': 0.62; 'due': 0.65; 'apart': 0.70; 'touch': 0.71; 'surprise': 0.72; 'completion': 0.79; 'chrisa': 0.84; "it'd": 0.84; 'subject:self': 0.84; 'to:none': 0.90 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=KLrcH+cO8L3dg3C+F2Lvj9dTn9mPYKSyidfSZZoAu4s=; b=D+GqEOawA7grnYqKdpthjVd7oq4aSqIJnZIr8Ntz7RYOBD7C5gzJgzh+TF4VrO2B+B ijjYpvMnEl9KVfOqR8oOTMnGFsCnV3OYdG6oMDxV1/HXABoSnu9TGi1LktuJ2NhgorSR zLPpAlgOny1cbzs4WzSKbae8Qr/Kx4Edln0A7uIWrpfizzigaimxl6Sf9UAXa+mwHH7f 1TuDx7WQGun0p5UQl3oVAWH+EbzdenFEdMb2otyNK28jxUjCuiklcPDSv7N+MsWr5lOB u9kqQ8TGOzvjMSaF6ti/p/bAvTBNrbAfOWjSyKwwcEPUQlriJEEDeIVx6ZcfSh6xJI+P gTUw== MIME-Version: 1.0 X-Received: by 10.107.16.149 with SMTP id 21mr32710704ioq.53.1432708368576; Tue, 26 May 2015 23:32:48 -0700 (PDT) In-Reply-To: <556554d9$0$2796$c3e8da3$76491128@news.astraweb.com> References: <551c8229-f426-45f0-a0ee-fdad1b161f59@googlegroups.com> <556554d9$0$2796$c3e8da3$76491128@news.astraweb.com> Date: Wed, 27 May 2015 16:32:48 +1000 Subject: Re: should "self" be changed? 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.20+ 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: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1432708376 news.xs4all.nl 2938 [2001:888:2000:d::a6]:54609 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:91284 On Wed, May 27, 2015 at 3:23 PM, Steven D'Aprano wrote: > On Wednesday 27 May 2015 06:45, Mark Lawrence wrote: > >> Apart from breaking all the tools that rely on "self" being spelt "self" >> this looks like an excellent idea. > > Tools which rely on self being spelled "self" are already broken. It's a > convention, nothing more, and there are various good reasons for breaking > the convention: > > - metaclasses > - classmethods > - custom descriptors > - nested classes If it truly relies on it, yes. But if I see a function that has "self" as its first parameter, I'm going to read it as a (probable) method rather than a stand-alone function, and it wouldn't surprise me if introspection and/or source code parsing made the same assumption. It's as strong a convention as "don't touch the ones that begin with an underscore", which is broken by the namedtuple due to namespacing requirements, but otherwise is fairly dependable (eg if tab completion skipped the underscore attributes, it'd be a bit less useful on namedtuples, but probably more practical overall). Using some other name in place of "self" should definitely remain *possible*, but not commonly done. ChrisA