Path: csiph.com!usenet.pasdenom.info!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed6.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'attributes': 0.07; 'completeness': 0.07; 'method,': 0.07; 'override': 0.07; 'python': 0.09; 'received:155': 0.09; 'sep': 0.09; 'subject:method': 0.09; 'terry': 0.09; 'accesses': 0.16; 'attributes.': 0.16; 'disclaimers': 0.16; 'disclaimers,': 0.16; 'from:addr:jpmorgan.com': 0.16; 'received:155.180': 0.16; 'received:159.53': 0.16; 'received:169.70': 0.16; 'received:169.70.184': 0.16; 'received:169.70.184.72': 0.16; 'received:exchad.jpmchase.net': 0.16; 'received:hubcr105.exchad.jpmchase.net': 0.16; 'received:jpmchase.com': 0.16; 'received:jpmchase.net': 0.16; 'reedy': 0.16; 'securities,': 0.16; 'skipped': 0.16; 'skips': 0.16; 'url:disclosures': 0.16; 'url:jpmorgan': 0.16; 'wrote:': 0.17; 'instance': 0.17; 'instance,': 0.17; '>>>': 0.18; 'code.': 0.20; 'issue.': 0.20; 'otherwise,': 0.20; 'to:name:python- list@python.org': 0.20; 'class.': 0.23; 'received:169.254': 0.24; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'accuracy': 0.27; 'chris': 0.28; 'received:169': 0.29; 'class': 0.29; 'filled': 0.30; 'function': 0.30; 'header:Received:8': 0.30; 'code': 0.31; 'goes': 0.33; 'instances': 0.33; 'subject:data': 0.33; 'to:addr :python-list': 0.33; 'so,': 0.35; 'pm,': 0.35; 'too.': 0.35; 'subject:?': 0.35; 'something': 0.35; 'except': 0.36; 'method': 0.36; 'should': 0.36; 'charset:us-ascii': 0.36; 'does': 0.37; 'subject:: ': 0.38; 'things': 0.38; 'sure': 0.38; 'to:addr:python.org': 0.39; 'think': 0.40; 'information,': 0.63; 'url:email': 0.63; 'legal': 0.65; 'subject': 0.66; 'purchase': 0.67; 'direct': 0.69; 'special': 0.73; 'sale': 0.76; 'received:169.254.8': 0.84; 'reminds': 0.84; 'why?': 0.84; 'hand,': 0.97 X-DKIM: OpenDKIM Filter v2.1.3 sf3.jpmchase.com q8SI29LH014901 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpmorgan.com; s=smtpout; t=1348855329; bh=ERUgJWglVYoCSAiswk6Inhi33rizvjVPJmU6NtpfSws=; h=From:To:Subject:Date:Message-ID:References:In-Reply-To: Content-Transfer-Encoding:MIME-Version:Content-Type; b=TwUWWOgRsQA77wZUI+RANuAj6Ma2SY0EjkY20okA7fqNS/CUYSyXRH76rLOQ9RiWz SxEvFENrcILhIm7X8QJfv043daEZ7juRRvTOBxazCwrhU5lDmseYRLU8PlSsD2ROv4 iUjO2zp/X4ZGuR/30kWdsTXzHoa29XBEN/DO1KL4= From: "Prasad, Ramit" To: "python-list@python.org" Subject: RE: data attributes override method attributes? Thread-Topic: data attributes override method attributes? Thread-Index: AQHNmy2fx+iO8l32NkO+geClnPNL35ebanYAgABSfACAAAKqAIAAB1UAgARIStA= Date: Fri, 28 Sep 2012 18:02:04 +0000 References: <931902e1-570b-4288-bb9b-de711318c5cd@googlegroups.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.67.79.47] Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-DLP-FWD: Yes Content-Type: text/plain; charset="us-ascii" 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: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1348855339 news.xs4all.nl 6914 [2001:888:2000:d::a6]:56028 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:30420 Terry Reedy wrote:=0D=0A> On 9/25/2012 4:07 PM, Ian Kelly wrote:=0D=0A> > O= n Tue, Sep 25, 2012 at 1:58 PM, Terry Reedy wrote:=0D= =0A> >> On 9/25/2012 11:03 AM, Chris Angelico wrote:=0D=0A> >>> Instance at= tributes override (shadow) class attributes=2E=0D=0A> >>=0D=0A> >>=0D=0A> >= > except for (some? all?) special methods=0D=0A> >=0D=0A> > Those names are= shadowed too=2E If you call foo=2E__len__() and the name=0D=0A> > is boun= d on the instance, it will call that function preferentially=2E=0D=0A> > It= 's just that when the special Python machinery calls the method, it=0D=0A> = > skips the instance and goes straight to the class=2E=0D=0A> =0D=0A> I add= ed "Ian Kelly reminds me that instance=2E__xxx__ is only skipped by=0D=0A> = the internal machinery and not by direct accesses in user code=2E In the=0D= =0A> other hand, docs, official or otherwise, are filled with things like= =0D=0A> 'len(a) calls a=2E__len__', so I think something should be said tha= t=0D=0A> giving instances special method attributes does not have the effec= t one=0D=0A> might expect=2E"=0D=0A> =0D=0A> to the issue=2E=0D=0A> =0D=0A= =0D=0A=0D=0AJust to make sure I am following, if you call=0D=0Afoo=2E__len_= _() it goes to the instance code while=0D=0Aif you do len(foo) it will go t= o class=2E__len__()?=0D=0A=0D=0AIf so, why? =0D=0A=0D=0AThis email is confi= dential and subject to important disclaimers and=0D=0Aconditions including = on offers for the purchase or sale of=0D=0Asecurities, accuracy and complet= eness of information, viruses,=0D=0Aconfidentiality, legal privilege, and l= egal entity disclaimers,=0D=0Aavailable at http://www=2Ejpmorgan=2Ecom/page= s/disclosures/email=2E