Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!news2.arglkargh.de!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'attributes': 0.07; 'method,': 0.07; 'override': 0.07; 'python': 0.09; 'sep': 0.09; 'subject:method': 0.09; 'terry': 0.09; 'attributes.': 0.16; 'reedy': 0.16; 'skips': 0.16; 'wrote:': 0.17; 'instance': 0.17; 'instance,': 0.17; 'class.': 0.23; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'received:209.85.212': 0.28; 'chris': 0.28; 'class': 0.29; 'function': 0.30; 'goes': 0.33; 'subject:data': 0.33; 'to:addr :python-list': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'too.': 0.35; 'subject:?': 0.35; 'received:209.85': 0.35; 'except': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'special': 0.73; 'to:name:python': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=5kUlPrZpeSxHARH+CEel8pPwStLIuvldaKFW78RGVKg=; b=gNzCDDgPlJ7JigRRsnRR0HY0nUipaY1qiFSHkVJDwJdIREBGANpzJydMgk2NjZmhPB IZGVpx2AOoJcfLIsgs675luBsnKBqdy7E20ixI2yvNXNrLBr/EqCImXkcHpUrmvRsdrf UGKkZwaK5WLetWRozcima0w+49ovG+yq+aPhNl7bnRG0Y/0Km6aos13QPkhpfq5kLh7S by9zJ2Prr6IyznYy0VdKYXtlLQH8eTCAtYOoSXlg6OvNDc+v90HG/vtHIfdJmi8oXwgr HfkvTIIbUvPwjZjuRgltGqkt0t14jhy+f7ol9cQ25OMwhK+AE1YX4KVMSSuwLHXqQRq0 kh7w== MIME-Version: 1.0 In-Reply-To: References: <931902e1-570b-4288-bb9b-de711318c5cd@googlegroups.com> From: Ian Kelly Date: Tue, 25 Sep 2012 14:07:58 -0600 Subject: Re: data attributes override method attributes? To: Python Content-Type: text/plain; charset=ISO-8859-1 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: 11 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1348603711 news.xs4all.nl 6971 [2001:888:2000:d::a6]:39109 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:30124 On Tue, Sep 25, 2012 at 1:58 PM, Terry Reedy wrote: > On 9/25/2012 11:03 AM, Chris Angelico wrote: >> Instance attributes override (shadow) class attributes. > > > except for (some? all?) special methods Those names are shadowed too. If you call foo.__len__() and the name is bound on the instance, it will call that function preferentially. It's just that when the special Python machinery calls the method, it skips the instance and goes straight to the class.