Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.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.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'attributes': 0.07; 'components.': 0.09; 'deemed': 0.09; 'logic': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'tracing': 0.09; 'implemented,': 0.16; 'inheritance': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'wrote:': 0.17; 'certainly': 0.17; 'examples': 0.18; 'together.': 0.21; 'flexibility': 0.23; "i've": 0.23; 'header :User-Agent:1': 0.26; 'url:wiki': 0.26; '(e.g.': 0.27; 'c++': 0.27; 'components': 0.27; 'header:X-Complaints-To:1': 0.28; 'though.': 0.29; 'writes:': 0.29; 'source': 0.29; 'class': 0.29; 'function': 0.30; 'code': 0.31; 'url:zope': 0.33; 'to:addr:python- list': 0.33; 'changed': 0.34; 'sometimes': 0.35; 'received:org': 0.36; 'but': 0.36; 'url:org': 0.36; 'charset:us-ascii': 0.36; 'does': 0.37; 'skip:z 10': 0.37; 'quite': 0.37; 'subject:: ': 0.38; 'things': 0.38; 'gives': 0.39; 'to:addr:python.org': 0.39; 'easily': 0.39; 'build': 0.39; 'header:Received:5': 0.40; 'more': 0.63; 'great': 0.64; 'become': 0.65; 'decided': 0.65; 'received:217': 0.68; 'article': 0.78; 'complex,': 0.84; 'neck.': 0.84; 'pain': 0.84; 'url:component': 0.84; 'inheritance,': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dieter Maurer Subject: Re: Private methods Date: Thu, 11 Oct 2012 08:04:50 +0200 References: <1krpbz9.1wge3j11123k2vN%real-not-anti-spam-address@apple-juice.co.uk> <1krpdak.u0qy9e1a4knspN%real-not-anti-spam-address@apple-juice.co.uk> <50742FD4.8030007@gmail.com> <5074b86b$0$6574$c3e8da3$5496439d@news.astraweb.com> <1krqopm.19fo57y1wri8yaN%real-not-anti-spam-address@apple-juice.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Gmane-NNTP-Posting-Host: pd9e091b4.dip0.t-ipconnect.de User-Agent: Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux) Cancel-Lock: sha1:DkceQlJTXRrxFh6Thn6gltAmr0U= 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: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1349935503 news.xs4all.nl 6963 [2001:888:2000:d::a6]:42907 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:31104 alex23 writes: > On 10 Oct, 17:03, real-not-anti-spam-addr...@apple-juice.co.uk (D.M. > Procida) wrote: >> It certainly makes it quick to build a class with the attributes I need, >> but it does make tracing logic sometimes a pain in the neck. >> >> I don't know what the alternative is though. > > Components. > > The examples are in C++ and it's about game development, but I found > this article to be very good at explaining the approach: > http://gameprogrammingpatterns.com/component.html > > I've become a big fan of components & adaptation using zope.interface: > http://wiki.zope.org/zope3/ZopeGuideComponents If multiple inheritance is deemed complex, adaptation is even more so: With multiple inheritance, you can quite easily see from the source code how things are put together. Adaptation follows the "inversion of control" principle. With this principle, how a function is implemented, is decided outside and can very easily be changed (e.g. through configuration). This gives great flexibility but also nightmares when things do not work as expected...