Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!lightspeed.eweka.nl!lightspeed.eweka.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!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.140 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.73; '*S*': 0.00; 'subject:Python': 0.06; '*not*': 0.07; 'def': 0.12; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'fraction': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'gary': 0.31; 'class': 0.32; 'this.': 0.32; 'brian': 0.33; 'add': 0.35; 'really': 0.36; 'doing': 0.36; 'method': 0.36; 'thanks': 0.36; 'searching': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'even': 0.60; 'new': 0.61; 'charset:windows-1252': 0.65; 'institute': 0.72; 'received:204': 0.75; 'dr.': 0.77; 'delegation': 0.84 Date: Sat, 24 Jan 2015 15:47:56 -0800 From: Gary Herron User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Delegation in Python References: <5ZKdnd6rbdZ3sVnJnZ2dnUVZ8mCdnZ2d@brightview.co.uk> In-Reply-To: <5ZKdnd6rbdZ3sVnJnZ2dnUVZ8mCdnZ2d@brightview.co.uk> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit 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: 1422143281 news.xs4all.nl 2972 [2001:888:2000:d::a6]:46850 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 3045 X-Received-Body-CRC: 179085699 Xref: csiph.com comp.lang.python:84521 On 01/24/2015 03:38 PM, Brian Gladman wrote: > On 24/01/2015 23:22, Chris Angelico wrote: >> class RF(Fraction): >> def is_integer(self): >> return self.numerator % self.denominator == 0 > Thanks for your help on this. I must admit that nowhere in a lot of > searching did I find that delegation is achieved by doing nothing! > > Brian That's *not* "doing nothing". And it's not even really "delegation". It's just sub-classing Fraction to add one new method and inherit all other methods. Gary Herron -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418