Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!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.023 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'used.': 0.07; 'python': 0.08; 'method:': 0.09; 'wrappers': 0.09; 'examples': 0.11; 'am,': 0.12; 'def': 0.15; "subject:' ": 0.15; 'hmm.': 0.16; 'cc:addr :python-list': 0.16; 'wrote:': 0.16; 'wed,': 0.17; 'cc:no real name:2**0': 0.20; 'cc:2**0': 0.22; 'header:In-Reply-To:1': 0.22; 'implicit': 0.23; 'mix': 0.23; 'sep': 0.23; 'pm,': 0.24; 'aug': 0.24; "i'm": 0.27; 'fact': 0.27; 'classes': 0.28; 'subject:need': 0.28; 'thu,': 0.28; 'url:mailman': 0.28; 'explicitly': 0.29; 'message-id:@mail.gmail.com': 0.29; 'cc:addr:python.org': 0.30; 'rarely': 0.30; 'class': 0.30; 'subject:?': 0.31; 'chris': 0.32; 'used,': 0.32; 'this.': 0.32; 'url:listinfo': 0.33; 'calling': 0.33; 'curious': 0.34; 'declared': 0.34; 'url:python': 0.36; 'useful': 0.36; 'but': 0.37; 'steven': 0.38; 'received:google.com': 0.38; 'url:org': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.39; 'happens': 0.40; '31,': 0.64; '"what': 0.67; 'received:209.85.215.174': 0.67; 'received:mail- ey0-f174.google.com': 0.67; 'around?': 0.84; 'self.value': 0.84; 'subject:always': 0.84; 'subject:class': 0.84; 'subject:self': 0.84; 'value):': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=961A/Q20SXyzJDCfDb5Rj11mgjLtx3BFrfKVsAWV3IE=; b=PU68WgowO98024okLxf4quMxPoa9sNiLEU0ARhus6A9WCX0M0tR0JI/pAcaywe1AiL z8twf0doOdYkLrbJz+dClcgw+5h3r33znvNaVMU0Km1JIWR/b77fw4bT60rQXGL5IdzT kP8HyfQf9Kbb30nxWYaXaMmn4S1mSBd9Fgn+k= MIME-Version: 1.0 In-Reply-To: References: <0dc26f12-2541-4d41-8678-4fa53f347acf@g9g2000yqb.googlegroups.com> <4e5e5628$0$29977$c3e8da3$5496439d@news.astraweb.com> <4e5ed670$0$29981$c3e8da3$5496439d@news.astraweb.com> Date: Wed, 31 Aug 2011 20:07:42 -0600 Subject: Re: Why do class methods always need 'self' as the first parameter? From: Eric Snow To: Chris Angelico Content-Type: text/plain; charset=ISO-8859-1 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1314842865 news.xs4all.nl 2428 [2001:888:2000:d::a6]:59317 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:12541 On Wed, Aug 31, 2011 at 7:47 PM, Chris Angelico wrote: > On Thu, Sep 1, 2011 at 10:48 AM, Steven D'Aprano > wrote: >> Python classes have a lot of dynamism made possible by the fact that methods >> are just wrappers around functions with an explicitly declared "self". That >> dynamism is rarely used, but not *that* rarely, and is very useful when >> used. Implicit self would likely negate all that. >> > > Hmm. Got any examples sitting around? I'm curious as to what you can > do with this. I'm like a kid with a new chemistry set - "what happens > if I mix a little of everything together?"... First thing that comes to mind is calling a base class's implementation of a method: class X(Y): def __init__(self, value): Y.__init__(self) self.value = value -eric > > ChrisA > -- > http://mail.python.org/mailman/listinfo/python-list >