Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!eweka.nl!hq-usenetpeers.eweka.nl!xlned.com!feeder7.xlned.com!news2.euro.net!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'python,': 0.02; 'talks': 0.03; 'algorithm': 0.03; 'interpreter': 0.04; 'subject:Python': 0.05; 'elements.': 0.05; 'method.': 0.05; 'say,': 0.05; '(of': 0.07; 'algorithms,': 0.07; 'patterns.': 0.07; 'missed': 0.09; 'python': 0.09; 'items)': 0.09; 'languages:': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'terry': 0.09; 'aug': 0.13; 'static': 0.13; 'language': 0.14; '(but': 0.15; '(when': 0.16; 'compiler,': 0.16; 'iterator': 0.16; 'iterator:': 0.16; 'lisp': 0.16; 'message-id:@dough.gmane.org': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'structures,': 0.16; 'subject: \n ': 0.16; 'subject:object': 0.16; 'subject:oriented': 0.16; 'subject:programming': 0.16; 'wrote:': 0.17; '2.2': 0.17; 'abuse': 0.17; 'passes': 0.17; 'jan': 0.18; 'obviously': 0.18; 'code,': 0.18; '(or': 0.18; 'discussion': 0.20; 'preferred': 0.20; 'features,': 0.22; 'pre': 0.22; 'example': 0.23; 'raise': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'wrote': 0.26; 'url:wiki': 0.26; 'coding': 0.27; 'c++': 0.27; 'header:X-Complaints-To:1': 0.28; 'rest': 0.28; 'represent': 0.28; '-0700,': 0.29; "d'aprano": 0.29; 'steven': 0.29; 'talked': 0.29; "i'm": 0.29; 'function': 0.30; 'point': 0.31; 'could': 0.32; 'to:addr:python-list': 0.33; 'everyone': 0.33; 'languages': 0.33; 'path': 0.35; 'pm,': 0.35; 'something': 0.35; 'there': 0.35; 'received:org': 0.36; 'really': 0.36; 'but': 0.36; "didn't": 0.36; 'subject:with': 0.36; 'uses': 0.37; 'item': 0.37; 'rather': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'talk': 0.38; 'sure': 0.38; 'to:addr:python.org': 0.39; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'think': 0.40; "you've": 0.61; 'skip:n 10': 0.63; 'more': 0.63; 'become': 0.65; 'url:cgi': 0.65; 'talking': 0.66; 'realized': 0.71; 'pictures': 0.74; 'yourself': 0.77; 'article': 0.78; 'old,': 0.83; 'construct': 0.84; 'descriptive': 0.84; 'received:fios.verizon.net': 0.84; 'subject:good': 0.84; 'composite': 0.91; 'have.': 0.95 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Looking for a good introduction to object oriented programming with Python Date: Tue, 07 Aug 2012 18:37:00 -0400 References: <54b916fe-9e2d-4f9e-b533-b5ecf677c8a5@a19g2000vba.googlegroups.com> <501f0e4a$0$29867$c3e8da3$5496439d@news.astraweb.com> <5021664b$0$29978$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-173-75-251-66.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0 In-Reply-To: <5021664b$0$29978$c3e8da3$5496439d@news.astraweb.com> 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: 53 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1344379062 news.xs4all.nl 6957 [2001:888:2000:d::a6]:43106 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:26741 On 8/7/2012 3:02 PM, Steven D'Aprano wrote: > On Sun, 05 Aug 2012 19:44:31 -0700, alex23 wrote: > >> I think you've entirely missed the point of Design Patterns. > > Perhaps I have. Or perhaps I'm just (over-)reacting to the abuse of > Patterns: > > http://c2.com/cgi/wiki?DesignPatternsConsideredHarmful > > or that they are a crutch for underpowered languages: I still remember reading an article something like "Implementing the Composite Pattern in C++". The example for the discussion was Pictures that could contain sub-Pictures as well as Graphic elements. I eventually realized that a) this is trivial in Python, b) the article was really about how to lie to a C++ compiler, so it would accept recursive heterogenous structures, and c) I preferred Python. > http://c2.com/cgi/wiki?AreDesignPatternsMissingLanguageFeatures > I think that as languages get more powerful, "Design Patterns" just > become language features, and people stop talking about them. Nobody > talks about Function Pattern, but everyone uses it. In Python, we don't > talk about the Iterator Pattern. We just use iterators. In pre 2.2 Python, there was talk about the pattern (but not with Capitals) and how to lie to the interpreter with a fake __getitem__ method. > I'm pretty sure that people could talk about good coding design before > the Gof4. As you say, they didn't invent the patterns. So people > obviously wrote code, and talked about algorithms, without the Gof4 > terminology. 'Divide and conquer' is an old, descriptive name for an algorithm action pattern. It is only incidentally about static structures. 'Dynamic programming' is a rather opaque name for a) an action patter for using the optimality principle* (when applicable) and b) not disposing of data one still needs. * the best path from A to B that passes through C is the best path from A to C plus the best path from C to B. Lisp is based on a simple data pattern (or is it a principle): collection (of dicrete items) = one item + remainder, used to both construct and deconstruct. Python iterator embody the the same principle. next(iterator) = iterator: return one item and mutate yourself to represent the rest -- or raise StopIteration. -- Terry Jan Reedy