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


Groups > comp.lang.python > #64041

Re: Chanelling Guido - dict subclasses

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!newsfeed.tele2net.at!newsfeed.utanet.at!feeder1.cambriumusenet.nl!82.197.223.108.MISMATCH!feeder2.cambriumusenet.nl!feeder3.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.81.MISMATCH!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <meltingwax@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; '*is*': 0.09; '[0]': 0.09; 'cc:addr:python-list': 0.11; 'jan': 0.12; "wouldn't": 0.14; 'keys.': 0.16; 'missing?': 0.16; 'non-string': 0.16; 'subject:subclasses': 0.16; 'substitution': 0.16; 'subtype': 0.16; 'to:addr:pearwood.info': 0.16; 'to:addr:steve+comp.lang.python': 0.16; "to:name:steven d'aprano": 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'saying': 0.22; 'cc:addr:python.org': 0.22; '\xa0if': 0.24; 'cc:2**0': 0.24; 'daniel': 0.26; 'task': 0.26; 'header:In-Reply-To:1': 0.27; 'properties': 0.29; 'message- id:@mail.gmail.com': 0.30; 'url:wiki': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'url:wikipedia': 0.31; 'violation': 0.31; 'etc.)': 0.35; 'objects': 0.35; 'but': 0.35; 'received:google.com': 0.35; '14,': 0.36; "he's": 0.36; 'url:org': 0.36; '(i.e.,': 0.38; 'desirable': 0.38; 'pm,': 0.38; 'according': 0.40; 'skip:* 10': 0.61; 'more': 0.64
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=YWGl3Vs5Fg76vo5lCy6mjCmRebGAmd3405mQ5HVQ7TA=; b=fmg3vtYvBV3IQcRDgNSzTO03ps2lubDZRAq2I4YWh79WiKZCKDgad9koCVZqGsk4Ez W98Yr6vtU00sUh2zZ92YCe/VgaCGVOc+AGoMCDu5yOrIs5+hcu3gZVgmDSQiLSM+mIMP /X0fW6/WCm9hYBnbaKZJlN3kjykQGagTqI5kH/Alu2GhV6JQmGZ+Xlr44n2HMxcCFLYp GH3ciat7yTnXvKLEnrThxcYb6Cj+zQRW3GV3AhA5ohWrFR19gP+carIlQ8fFD4gz9Ax3 AmXp0uAOlMprmcbBtVDnNsRot6WQDq8QKGhCejCtDWu5zNIf8AKkyFWV+5UQ8wJS7pyx jYPw==
MIME-Version 1.0
X-Received by 10.194.77.7 with SMTP id o7mr5306033wjw.35.1389833453409; Wed, 15 Jan 2014 16:50:53 -0800 (PST)
Sender meltingwax@gmail.com
In-Reply-To <52d5e408$0$29970$c3e8da3$5496439d@news.astraweb.com>
References <52d5e408$0$29970$c3e8da3$5496439d@news.astraweb.com>
Date Wed, 15 Jan 2014 19:50:53 -0500
X-Google-Sender-Auth 271PuDvDw06E8AbqMhGY5jzBeJU
Subject Re: Chanelling Guido - dict subclasses
From Daniel da Silva <var.mail.daniel@gmail.com>
To "Steven D'Aprano" <steve+comp.lang.python@pearwood.info>
Content-Type multipart/alternative; boundary=047d7bfd05fc499b6504f00bd1f1
X-Mailman-Approved-At Thu, 16 Jan 2014 03:50:12 +0100
Cc Python <python-list@python.org>
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.5562.1389840613.18130.python-list@python.org> (permalink)
Lines 73
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1389840613 news.xs4all.nl 2925 [2001:888:2000:d::a6]:35473
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:64041

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On Tue, Jan 14, 2014 at 8:27 PM, Steven D'Aprano <
steve+comp.lang.python@pearwood.info> wrote:
>
> But reading Guido, I think he's saying that wouldn't be a good idea. I
> don't get it -- it's not a violation of the Liskov Substitution
> Principle, because it's more restrictive, not less. What am I missing?
>

Just to be pedantic, this *is* a violation of the Liskov Substution
Principle. According to Wikipedia, the principle states:

 if S is a subtype <http://en.wikipedia.org/wiki/Subtype> of T, then
> objects of type <http://en.wikipedia.org/wiki/Datatype> T may be replaced
> with objects of type S (i.e., objects of type S may be *substituted* for
> objects of type T) without altering any of the desirable properties of that
> program (correctness, task performed, etc.) [0]<http://en.wikipedia.org/wiki/Liskov_substitution_principle>


 Since S (TextOnlyDict) is more restrictive, it cannot be replaced for T
(dict) because the program may be using non-string keys.


Daniel

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


Thread

Chanelling Guido - dict subclasses Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-01-15 01:27 +0000
  Re: Chanelling Guido - dict subclasses Ned Batchelder <ned@nedbatchelder.com> - 2014-01-14 21:04 -0500
  Re: Chanelling Guido - dict subclasses Terry Reedy <tjreedy@udel.edu> - 2014-01-14 22:48 -0500
  Re: Chanelling Guido - dict subclasses F <f@hop2it.be> - 2014-01-15 07:00 +0000
  Re: Chanelling Guido - dict subclasses Peter Otten <__peter__@web.de> - 2014-01-15 09:40 +0100
    Re: Chanelling Guido - dict subclasses John Ladasky <john_ladasky@sbcglobal.net> - 2014-01-15 08:51 -0800
      Re: Chanelling Guido - dict subclasses Peter Otten <__peter__@web.de> - 2014-01-15 19:35 +0100
      Re: Chanelling Guido - dict subclasses Devin Jeanpierre <jeanpierreda@gmail.com> - 2014-01-15 22:30 -0800
  Re: Chanelling Guido - dict subclasses Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-01-15 09:10 +0000
  Re: Chanelling Guido - dict subclasses Tim Chase <python.list@tim.thechases.com> - 2014-01-15 05:03 -0600
  Re: Chanelling Guido - dict subclasses Daniel da Silva <var.mail.daniel@gmail.com> - 2014-01-15 19:50 -0500
    Re: Chanelling Guido - dict subclasses Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-01-16 17:17 +1300

csiph-web