Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!news2.arglkargh.de!news.wiretrip.org!newsfeed.xs4all.nl!newsfeed5.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; 'subject:Python': 0.04; 'instance': 0.05; 'def': 0.13; 'wrote:': 0.14; 'chad': 0.16; 'did,': 0.16; 'received:192.168.200': 0.16; 'subject:Classes': 0.16; 'cc:no real name:2**0': 0.20; 'cc:2**0': 0.20; 'header:In- Reply-To:1': 0.22; 'subject:question': 0.22; 'cc:addr:python- list': 0.22; 'pass': 0.27; 'class': 0.29; 'cc:addr:python.org': 0.31; 'created': 0.33; 'test': 0.33; 'received:192': 0.34; 'print': 0.35; 'header:User-Agent:1': 0.35; 'received:192.168': 0.37; 'how': 0.39; 'skip:h 20': 0.60; 'subject:about': 0.66 X-IronPort-AV: E=Sophos;i="4.64,252,1301868000"; d="scan'208";a="1274521" X-Virus-Scanned: amavisd-new at zimbra.sequans.com Date: Thu, 21 Apr 2011 18:30:14 +0200 From: Jean-Michel Pichavant User-Agent: Mozilla-Thunderbird 2.0.0.24 (X11/20100328) MIME-Version: 1.0 To: chad Subject: Re: A question about Python Classes References: <2219ee53-e8aa-4ac4-839f-014c3d1b1914@a19g2000prj.googlegroups.com> In-Reply-To: <2219ee53-e8aa-4ac4-839f-014c3d1b1914@a19g2000prj.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: 31 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1303403421 news.xs4all.nl 65870 [::ffff:82.94.164.166]:51893 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:3809 chad wrote: > Let's say I have the following.... > > class BaseHandler: > def foo(self): > print "Hello" > > class HomeHandler(BaseHandler): > pass > > > Then I do the following... > > test = HomeHandler() > test.foo() > > How can HomeHandler call foo() when I never created an instance of > BaseHandler? > > Chad > you did, test is an instance of BaseHandler. > isinstance(test, HomeHandler) < True > isinstance(test, BaseHandler) < True JM