Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #39318

Re: Differences creating tuples and collections.namedtuples

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 <rosuav@gmail.com>
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 <kg1gg8$2ot$1@ger.gmane.org>
References <7a40a426-baa9-46f8-8f9d-59ba32b044f3@googlegroups.com> <mailman.1972.1361222953.2939.python-list@python.org> <5122c4d7$0$29982$c3e8da3$5496439d@news.astraweb.com> <kg1gg8$2ot$1@ger.gmane.org>
Date Wed, 20 Feb 2013 17:50:25 +1100
Subject Re: Differences creating tuples and collections.namedtuples
From Chris Angelico <rosuav@gmail.com>
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 <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2087.1361343028.2939.python-list@python.org> (permalink)
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

Show key headers only | View raw


On Wed, Feb 20, 2013 at 2:38 PM, Terry Reedy <tjreedy@udel.edu> 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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Differences creating tuples and collections.namedtuples John Reid <johnbaronreid@gmail.com> - 2013-02-18 03:47 -0800
  Re: Differences creating tuples and collections.namedtuples Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-02-18 12:03 +0000
  Re: Differences creating tuples and collections.namedtuples Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-02-18 12:05 +0000
  Re: Differences creating tuples and collections.namedtuples Dave Angel <davea@davea.name> - 2013-02-18 07:11 -0500
  Re: Differences creating tuples and collections.namedtuples John Reid <johnbaronreid@gmail.com> - 2013-02-18 13:49 +0000
  Re: Differences creating tuples and collections.namedtuples John Reid <johnbaronreid@gmail.com> - 2013-02-18 13:51 +0000
  Re: Differences creating tuples and collections.namedtuples John Reid <j.reid@mail.cryst.bbk.ac.uk> - 2013-02-18 14:09 +0000
    Re: Differences creating tuples and collections.namedtuples raymond.hettinger@gmail.com - 2013-02-18 23:48 -0800
      Re: Differences creating tuples and collections.namedtuples Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-19 08:06 +0000
      Re: Differences creating tuples and collections.namedtuples Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-19 08:57 +0000
      Re: Differences creating tuples and collections.namedtuples Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-19 08:06 +0000
      Re: Differences creating tuples and collections.namedtuples Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-19 08:05 +0000
    Re: Differences creating tuples and collections.namedtuples raymond.hettinger@gmail.com - 2013-02-18 23:48 -0800
  Re: Differences creating tuples and collections.namedtuples Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-02-18 14:15 +0000
  Re: Differences creating tuples and collections.namedtuples John Reid <johnbaronreid@gmail.com> - 2013-02-18 14:18 +0000
  Re: Differences creating tuples and collections.namedtuples Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-02-18 14:12 +0000
  Re: Differences creating tuples and collections.namedtuples John Reid <j.reid@mail.cryst.bbk.ac.uk> - 2013-02-18 14:23 +0000
  Re: Differences creating tuples and collections.namedtuples Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-02-18 14:53 +0000
  Re: Differences creating tuples and collections.namedtuples John Reid <j.reid@mail.cryst.bbk.ac.uk> - 2013-02-18 15:07 +0000
  Re: Differences creating tuples and collections.namedtuples Terry Reedy <tjreedy@udel.edu> - 2013-02-18 16:28 -0500
    Re: Differences creating tuples and collections.namedtuples Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-19 11:18 +1100
      Re: Differences creating tuples and collections.namedtuples Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-02-19 01:43 +0000
        Re: Differences creating tuples and collections.namedtuples Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-19 14:06 +1100
          Re: Differences creating tuples and collections.namedtuples Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2013-02-19 21:27 +1300
      Re: Differences creating tuples and collections.namedtuples Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2013-02-19 20:54 +1300
      Re: Differences creating tuples and collections.namedtuples John Reid <j.reid@mail.cryst.bbk.ac.uk> - 2013-02-19 09:30 +0000
      Re: Differences creating tuples and collections.namedtuples Terry Reedy <tjreedy@udel.edu> - 2013-02-19 22:38 -0500
        Re: Differences creating tuples and collections.namedtuples Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-22 10:38 +0000
      Re: Differences creating tuples and collections.namedtuples Chris Angelico <rosuav@gmail.com> - 2013-02-20 17:50 +1100
        Re: Differences creating tuples and collections.namedtuples Roy Smith <roy@panix.com> - 2013-02-20 09:09 -0500
    Re: Differences creating tuples and collections.namedtuples Roy Smith <roy@panix.com> - 2013-02-18 20:11 -0500
  Re: Differences creating tuples and collections.namedtuples alex23 <wuwei23@gmail.com> - 2013-02-18 17:47 -0800
    Re: Differences creating tuples and collections.namedtuples John Reid <j.reid@mail.cryst.bbk.ac.uk> - 2013-02-19 09:36 +0000

csiph-web