Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #30124

Re: data attributes override method attributes?

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 <ian.g.kelly@gmail.com>
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 <k3t2di$9f6$1@ger.gmane.org>
References <931902e1-570b-4288-bb9b-de711318c5cd@googlegroups.com> <mailman.1338.1348582105.27098.python-list@python.org> <c3fb0a89-abb9-4107-89cd-3f4ee17b40e1@t2g2000pbt.googlegroups.com> <k3sgio$9v$1@ger.gmane.org> <CAPTjJmo9A2_0hjy2RJW+ALAvd4CTmUfOfh8sy7LspSJxdiWPgw@mail.gmail.com> <k3t2di$9f6$1@ger.gmane.org>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Tue, 25 Sep 2012 14:07:58 -0600
Subject Re: data attributes override method attributes?
To Python <python-list@python.org>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1372.1348603711.27098.python-list@python.org> (permalink)
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

Show key headers only | View raw


On Tue, Sep 25, 2012 at 1:58 PM, Terry Reedy <tjreedy@udel.edu> 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.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

data attributes override method attributes? Jayden <jayden.shui@gmail.com> - 2012-09-25 06:41 -0700
  Re: data attributes override method attributes? alex23 <wuwei23@gmail.com> - 2012-09-25 06:52 -0700
  Re: data attributes override method attributes? Peter Otten <__peter__@web.de> - 2012-09-25 16:08 +0200
    Re: data attributes override method attributes? alex23 <wuwei23@gmail.com> - 2012-09-25 07:11 -0700
      Re: data attributes override method attributes? Peter Otten <__peter__@web.de> - 2012-09-25 16:54 +0200
      Re: data attributes override method attributes? Chris Angelico <rosuav@gmail.com> - 2012-09-26 01:03 +1000
      Re: data attributes override method attributes? Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-09-25 16:54 +0200
      Re: data attributes override method attributes? Terry Reedy <tjreedy@udel.edu> - 2012-09-25 15:58 -0400
      Re: data attributes override method attributes? Ian Kelly <ian.g.kelly@gmail.com> - 2012-09-25 14:07 -0600
      Re: data attributes override method attributes? Terry Reedy <tjreedy@udel.edu> - 2012-09-25 16:18 -0400
      Re: data attributes override method attributes? Terry Reedy <tjreedy@udel.edu> - 2012-09-25 16:34 -0400
      RE: data attributes override method attributes? "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-09-28 18:02 +0000
        Re: data attributes override method attributes? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-29 03:20 +0000
      Re: data attributes override method attributes? Ian Kelly <ian.g.kelly@gmail.com> - 2012-09-28 12:25 -0600
      Re: data attributes override method attributes? Terry Reedy <tjreedy@udel.edu> - 2012-09-28 14:26 -0400
    Re: data attributes override method attributes? Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-09-25 21:52 +0200
  Re: data attributes override method attributes? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-25 14:12 +0000

csiph-web