Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #80159
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!bcyclone05.am1.xlned.com!bcyclone05.am1.xlned.com!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.011 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'class,': 0.07; 'cc:addr :python-list': 0.11; '12:50': 0.16; '__new__': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hierarchy': 0.16; 'indent': 0.16; 'inheritance': 0.16; 'mutable': 0.16; 'route,': 0.16; 'subclass': 0.16; 'subject:Classes': 0.16; 'wrote:': 0.18; 'restrictions': 0.19; 'shape': 0.19; '+0000': 0.22; 'cc:addr:python.org': 0.22; 'creating': 0.23; 'fine': 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; 'suggested': 0.26; 'header:In- Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'gives': 0.31; 'follows': 0.31; 'class': 0.32; 'probably': 0.32; 'another': 0.32; "i'd": 0.34; 'equal': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'skip:> 10': 0.36; 'level': 0.37; 'being': 0.38; 'nov': 0.38; 'simply': 0.61; "you're": 0.61; 'back': 0.62; 'square': 0.74; 'special': 0.74; 'potentially': 0.81; '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=iLxJG1yB/5LmbwzaZ1cKYXfyziI5/VKs1gRZUnrTTo8=; b=WfOxxiddPvWgHNwwfVk+Lefy/P7XAdYqy1xrbyMz5bpECjvAwZGcf3VQnr5fJhl6rt 8ndQI/2HR7O2S9Us44MO3EA5FYyq0j/M3Utmom8ouy6XaJhZTkjYeXWy0ms572Ia1cO7 u6xPMHzLW8oMNYxmGMKrtKI4/03sdUuz+mF326r4kk7Kb1Bd/WrZIWAwncWeSKYMZgc3 IF1NSVoKehRA/HlrOmpScdOk390YjvbqUWJgL+W6cO/z5zcPuIZiBjDuaPweedPNc3BJ ByAgbsbdjuG4OyLrDsOK271YBo7X0qx3l64J6UfXbVwd3hj6ejPY8oIKM9cIDuS3KGk3 fVaw== |
| MIME-Version | 1.0 |
| X-Received | by 10.107.136.94 with SMTP id k91mr32131677iod.43.1415028870656; Mon, 03 Nov 2014 07:34:30 -0800 (PST) |
| In-Reply-To | <1r1f5ahd8qjh8fk5a3dpjgo75s7ejf7064@4ax.com> |
| References | <mailman.15375.1414796262.18130.python-list@python.org> <2i585a5s6d1aagbh6ot2b88i51o8jhq0db@4ax.com> <et685adhnqlerm642uh9dlhs80lmcmhc05@4ax.com> <mailman.15392.1414857661.18130.python-list@python.org> <g83a5apmbvnfh5bbulfqemqhvjvq57vqnp@4ax.com> <m34upd$mpq$2@dont-email.me> <mailman.15405.1414924342.18130.python-list@python.org> <m357up$mpq$3@dont-email.me> <mailman.15410.1414945885.18130.python-list@python.org> <m36rr0$mpq$5@dont-email.me> <1r1f5ahd8qjh8fk5a3dpjgo75s7ejf7064@4ax.com> |
| Date | Tue, 4 Nov 2014 02:34:30 +1100 |
| Subject | Re: Classes |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <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 <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.15433.1415028873.18130.python-list@python.org> (permalink) |
| Lines | 37 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1415028873 news.xs4all.nl 2941 [2001:888:2000:d::a6]:38149 |
| X-Complaints-To | abuse@xs4all.nl |
| X-Received-Bytes | 5044 |
| X-Received-Body-CRC | 997293798 |
| Xref | csiph.com comp.lang.python:80159 |
Show key headers only | View raw
On Tue, Nov 4, 2014 at 12:50 AM, Dennis Lee Bieber <wlfraed@ix.netcom.com> wrote: > On Mon, 3 Nov 2014 03:12:32 +0000 (UTC), Denis McMahon > <denismfmcmahon@gmail.com> declaimed the following: > >>So: >> >>Quadrilateral >> Parallelogram >> Square >> Rectangle >> Rhombus >> Diamond (4 sides eq) >> Trapezoid >> Arrowhead >> >>Is an arrowhead a trapezoid? > > I'd probably indent square under rectangle, and indent diamond where it > is -- both being restrictions on rectangle/rhombus > > But we may need another category, convex and concave; the arrowhead > would fall into the concave grouping. That's fine if you're creating a taxonomical hierarchy of immutables, but neither works if you're creating a mutable class hierarchy that follows LSP. The only way you can make any of this work (as someone suggested earlier, I believe) is by having __new__ potentially return a subclass, so if you ask Parallelogram to give you one with all sides equal and all angles equal, it gives you back a Square. But since a square is a special form of rhombus as well as a special form of rectangle, you'd have to use multiple inheritance or an AST-style subclass hook to verify. Of course, if you're going down that route, you probably want to take this up a level and have a Shape class, and have the subclass hook simply check if it's four-sided as well. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Classes Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-30 16:16 -0400
Re: Classes sohcahtoa82@gmail.com - 2014-10-30 13:33 -0700
Re: Classes Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-30 17:00 -0400
Re: Classes Rob Gaddi <rgaddi@technologyhighland.invalid> - 2014-10-30 13:34 -0700
Re: Classes Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-30 17:00 -0400
Re: Classes Larry Hudson <orgnut@yahoo.com> - 2014-10-30 14:28 -0700
Re: Classes Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-30 17:34 -0400
Re: Classes sohcahtoa82@gmail.com - 2014-10-30 18:21 -0700
Re: Classes alister <alister.nospam.ware@ntlworld.com> - 2014-10-31 09:59 +0000
Re: Classes Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-31 10:07 -0400
Re: Classes "ast" <nomail@invalid.com> - 2014-10-31 10:05 +0100
Re: Classes "ast" <nomail@invalid.com> - 2014-10-31 10:18 +0100
Re: Classes Chris Angelico <rosuav@gmail.com> - 2014-10-31 20:21 +1100
Re: Classes Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-31 10:05 -0400
Re: Classes Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-31 08:47 -0600
Re: Classes Grant Edwards <invalid@invalid.invalid> - 2014-10-31 15:49 +0000
Re: Classes Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-31 12:31 -0400
Re: Classes Chris Angelico <rosuav@gmail.com> - 2014-11-01 03:37 +1100
Re: Classes Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-31 12:47 -0400
Re: Classes Chris Angelico <rosuav@gmail.com> - 2014-11-01 04:02 +1100
Re: Classes Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-31 13:31 -0400
Re: Classes Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-10-31 12:39 -0500
Re: Classes Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-31 13:57 -0400
Re: Classes Rob Gaddi <rgaddi@technologyhighland.invalid> - 2014-10-31 10:40 -0700
Re: Classes Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-11-01 11:17 +1300
Re: Classes Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-01 12:06 +1100
Re: Classes Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-01 00:12 -0600
Re: Classes Chris Angelico <rosuav@gmail.com> - 2014-11-01 17:32 +1100
Re: Classes Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-11-03 00:32 +1300
Re: Classes Dave Angel <davea@davea.name> - 2014-10-31 13:20 -0400
Re: Classes Marko Rauhamaa <marko@pacujo.net> - 2014-10-31 19:35 +0200
Re: Classes Grant Edwards <invalid@invalid.invalid> - 2014-10-31 17:40 +0000
Re: Classes Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-31 18:26 -0400
Re: Classes Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-01 12:09 +1100
Re: Classes Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-01 04:06 +1100
Re: Classes Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-31 13:18 -0400
Re: Classes Rob Gaddi <rgaddi@technologyhighland.invalid> - 2014-10-31 10:43 -0700
Re: Classes Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-31 14:18 -0400
Re: Classes Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-31 14:42 -0400
Re: Classes Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-31 18:57 -0400
Re: Classes Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-31 19:22 -0400
Re: Classes Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-31 19:32 -0400
Re: Classes Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-11-01 12:00 -0400
Re: Classes Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-11-01 12:42 -0400
Re: Classes Denis McMahon <denismfmcmahon@gmail.com> - 2014-11-02 09:50 +0000
Re: Classes Tim Delaney <timothy.c.delaney@gmail.com> - 2014-11-02 21:32 +1100
Re: Classes Denis McMahon <denismfmcmahon@gmail.com> - 2014-11-02 12:27 +0000
Re: Classes Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-11-02 11:31 -0500
Re: Classes Denis McMahon <denismfmcmahon@gmail.com> - 2014-11-03 03:12 +0000
Re: Classes Dan Sommers <dan@tombstonezero.net> - 2014-11-03 06:29 +0000
Re: Classes Denis McMahon <denismfmcmahon@gmail.com> - 2014-11-04 01:10 +0000
Re: Classes Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-11-04 18:30 +1300
Re: Classes Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-11-03 08:50 -0500
Re: Classes Chris Angelico <rosuav@gmail.com> - 2014-11-04 02:34 +1100
Re: Classes Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-03 07:47 -0700
Re: Classes Larry Hudson <orgnut@yahoo.com> - 2014-11-02 14:03 -0800
Re: Classes Chris Angelico <rosuav@gmail.com> - 2014-11-01 07:51 +1100
Re: Classes sohcahtoa82@gmail.com - 2014-10-31 14:24 -0700
Re: Classes Rob Gaddi <rgaddi@technologyhighland.invalid> - 2014-10-31 14:40 -0700
Re: Classes Chris Angelico <rosuav@gmail.com> - 2014-11-01 08:56 +1100
Re: Classes Chris Angelico <rosuav@gmail.com> - 2014-11-01 08:36 +1100
Re: Classes Grant Edwards <invalid@invalid.invalid> - 2014-10-31 17:43 +0000
Re: Classes Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-31 14:11 +0000
Re: Classes Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-31 12:49 -0400
Re: Classes "ast" <nomail@invalid.com> - 2014-10-31 19:31 +0100
Re: Classes Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-31 14:36 -0400
Re: Classes Joel Goldstick <joel.goldstick@gmail.com> - 2014-10-31 14:41 -0400
Re: Classes Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-31 14:56 -0400
csiph-web