Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!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.016 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'prevents': 0.09; 'subclass': 0.09; 'subclasses': 0.09; 'substitution': 0.09; 'terry': 0.09; 'compromise': 0.16; 'debates': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'reedy': 0.16; 'similarly,': 0.16; 'subtraction': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'instance': 0.17; 'feb': 0.19; 'define': 0.20; 'bird': 0.23; 'allows': 0.25; 'header:In-Reply-To:1': 0.25; 'ago': 0.27; 'message-id:@mail.gmail.com': 0.27; 'oop': 0.29; 'sense': 0.31; 'could': 0.32; 'programming,': 0.33; 'problem': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85.220': 0.35; "won't": 0.35; 'received:209.85': 0.35; 'but': 0.36; 'method': 0.36; 'should': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'fact': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'kind': 0.61; 'necessarily': 0.63; '20,': 0.65; 'square': 0.75; '2013': 0.84; 'succeed.': 0.84; 'enthusiasts': 0.91; 'demand': 0.96 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=auWiRxdavKgr7gyxp0gvOjEogemoUYWtBQxN/MawQ9Y=; b=TkPWSxWEDExY3hTMcSOSmzEbF5LGkucU7G/3zQC9nUYqom3PQUj9fgCMQa/7Ls2t+e KZ2VmHNdHP8KOcRwR7rHwSLPY4hFvyKvhlpiGe1DJqxDPcWd51EBqfmeQaLQUE1x9xjP thptlHAqR08NcLGwiPD7j+kKcNb0I2pQ8/ycdDsAIzRLyY6VRirKz9uUsUSnIHYcy0oO vz7faJe9Dqk/NJTQzrHKfBmdOAEQGXwMZkd4KqDEvQWNrrUiznGkYwHiPjbUgPoNsZT1 u8rcUsp7opWS2CmXZKplol2DVo3rZ/K71s1T9NfH3qGlcyXfIhKlBdp5uMGVz8c3upm0 xe5w== MIME-Version: 1.0 X-Received: by 10.52.67.164 with SMTP id o4mr20996761vdt.42.1361343025986; Tue, 19 Feb 2013 22:50:25 -0800 (PST) In-Reply-To: References: <7a40a426-baa9-46f8-8f9d-59ba32b044f3@googlegroups.com> <5122c4d7$0$29982$c3e8da3$5496439d@news.astraweb.com> Date: Wed, 20 Feb 2013 17:50:25 +1100 Subject: Re: Differences creating tuples and collections.namedtuples From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1361343028 news.xs4all.nl 6903 [2001:888:2000:d::a6]:45200 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:39318 On Wed, Feb 20, 2013 at 2:38 PM, Terry Reedy wrote: > Liskov Substitution Principle (LSP): I met this over 15 years ago reading > debates among OOP enthusiasts about whether Rectangle should be a subclass > of Square or Square a subclass of Rectangle, and similarly, whether Ostrich > can be a legitimate subclass of Bird. > > The problem I see with the LSP for modeling either abstract or concrete > entities is that we in fact do define subclasses by subtraction or > limitation, as well as by augmentation, while the LSP only allows the > latter. A plausible compromise is to demand LSP in terms of programming, but not necessarily functionality. So an Ostrich would have a fly() method that returns some kind of failure, in the same way that any instance of any flying-bird could have injury or exhaustion that prevents it from flying. It still makes sense to attempt to fly - an ostrich IS a bird - but it just won't succeed. ChrisA