Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.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.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'class,': 0.07; 'whichever': 0.09; 'width': 0.09; 'cc:addr:python-list': 0.11; 'equal.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hierarchy,': 0.16; 'subject:Classes': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'example.': 0.24; 'cc:2**0': 0.24; 'define': 0.26; 'header:In- Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'url:wiki': 0.31; 'correctly.': 0.31; 'enforce': 0.31; 'url:wikipedia': 0.31; 'received:google.com': 0.35; 'url:org': 0.36; 'wrong': 0.37; 'nov': 0.38; 'length': 0.61; 'confirm': 0.64; 'here': 0.66; 'square': 0.74; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=WJim/t45t3KUzibFz3tXsf1HCF0lyCtT6sQPWWpqGzI=; b=LDTqwEkFLIkaVza/bsGXVLn94p6Bg3qz9Ld9HoY7IdQXYuu/Z7guBO8vu6bwAanKdv IN/QC9IzxH/thudEHFL4g1yaffRr5ad5lFIIBgCwSLMy1pIfF/P2ZP43eWRLz428je/h Ao3A1HKyrvxGh9Bpwsh1nraiEj854H+y8Z6Gx8Q9FNc34ARJ7g2o4n8hXQqcI0LlZaM2 260baQMaav+bShHhUCox2sQbOB5ZnfHVPeStSwLkwg2iLBqs7XqZD82s93iBCMcg3gR/ I9OkJWmAOonePRGaNie0wRYK65S4m+Ht69nvwGDUD1JKz/e+Fl8gsisLmb3FQIz0k7Uj 1sRg== MIME-Version: 1.0 X-Received: by 10.50.79.135 with SMTP id j7mr7199903igx.14.1414788667001; Fri, 31 Oct 2014 13:51:07 -0700 (PDT) In-Reply-To: <20141031104319.02e1ca6f@rg.highlandtechnology.com> References: <51755at03r0bidjqh3qf0hhpvjr8756ill@4ax.com> <545350c3$0$23449$426a74cc@news.free.fr> <5453c1a6$0$12981$c3e8da3$5496439d@news.astraweb.com> <7pg75alj1qn97hlirk81f7nqd265emgu05@4ax.com> <20141031104319.02e1ca6f@rg.highlandtechnology.com> Date: Sat, 1 Nov 2014 07:51:06 +1100 Subject: Re: Classes From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1414788668 news.xs4all.nl 2835 [2001:888:2000:d::a6]:56687 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:80057 On Sat, Nov 1, 2014 at 4:43 AM, Rob Gaddi wrote: > Define a Square class, subclassed from Rectangle. Use getters/setters > to enforce that the length and width must be equal. Confirm that > length and width remain locked, and that perimeter() and area() work > correctly. Here we go again... http://en.wikipedia.org/wiki/Circle-ellipse_problem Square and Rectangle are just as "obviously" the other way around in the hierarchy, and it's wrong whichever way you do it. Not a good example. ChrisA