Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!weretis.net!feeder1.news.weretis.net!feeder.erje.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:" ': 0.03; 'suppose': 0.05; 'raised': 0.07; 'raises': 0.07; '(sorry,': 0.09; 'question:': 0.09; 'rule.': 0.09; 'subclasses': 0.09; 'substitution': 0.09; 'am,': 0.13; 'wrote:': 0.15; 'finney': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'resist': 0.16; 'subject: \n ': 0.16; 'subject:() ': 0.16; 'things?': 0.16; 'utterly': 0.16; '\xa0def': 0.16; '16,': 0.16; 'subject:was': 0.16; 'subject:list': 0.16; 'subject:skip:d 10': 0.17; 'received:209.85.210.174': 0.19; 'received:mail- iy0-f174.google.com': 0.19; 'subject:not': 0.21; 'header:In-Reply- To:1': 0.22; 'breaks': 0.23; '"this': 0.25; 'raise': 0.28; 'sat,': 0.28; 'message-id:@mail.gmail.com': 0.28; 'student': 0.30; '*and*': 0.30; 'class': 0.31; 'chris': 0.32; 'does': 0.32; 'break': 0.33; 'to:addr:python-list': 0.34; 'instead': 0.34; 'sense,': 0.35; 'speaking': 0.35; 'but': 0.37; 'could': 0.37; 'another': 0.38; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.38; 'should': 0.39; 'to:addr:python.org': 0.39; 'received:209': 0.40; 'act': 0.64; '10:04': 0.84; 'ps.': 0.84; 'subject:should': 0.84; 'subject:place': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=c7+QYxmf/62yYmxQgMiMA5usBiEvb6FHqSybbcsGTi4=; b=TIScFFeKcipK9J+DVMZQ2hQJXHR9tKfXcd045h4PUBXYUKvCOCw/XJOWAYXupv6G7r P2G/3tWzYbE1q2uY2Bx70tQP07Oc2EaxyxM4/T0Iv9kyMTlWrpfNJg/uZ9tUebhOWnNp OwVZ9Cn+f4XNU2cxle/8KaQB4BUfVjwYf/nSI= MIME-Version: 1.0 In-Reply-To: <87zkkf9jl7.fsf_-_@benfinney.id.au> References: <87ei1sb3x9.fsf@benfinney.id.au> <87zkkf9jl7.fsf_-_@benfinney.id.au> Date: Sat, 16 Jul 2011 10:17:48 +1000 Subject: Re: Liskov substitution principle (was: list(), tuple() should not place at "Built-in functions" in documentation) From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1310775472 news.xs4all.nl 23900 [2001:888:2000:d::a6]:37466 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:9588 On Sat, Jul 16, 2011 at 10:04 AM, Ben Finney w= rote: > =A0 =A0 =A0 =A0def study(self, subject): > =A0 =A0 =A0 =A0 =A0 =A0raise NotImplementedError > > See? We can have overstretched analogies *and* remain within the Liskov > substitution principle. > Hehe! Of course I was speaking utterly in jest, but this raises (sorry, never could resist a bad pun) another question: What if the base class implemented study(), and then LazyStudent subclasses Student but makes study() raise NotImpl? Would that break things? In a sense, it breaks the whole "this is a student so it should act like a student" rule. Suppose it raised UtterApathyError instead - does that break the LSP? Chris A PS. The world's first horseless signature... trapped in the air!