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


Groups > comp.lang.python > #32996

Re: duck typing assert

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin3!goblin1!goblin.stu.neva.ru!newsreader4.netcologne.de!news.netcologne.de!feeder3.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.85.MISMATCH!newsfeed.xs4all.nl!newsfeed6.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.037
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'argument': 0.04; 'arguments': 0.07; 'matches': 0.07; 'template': 0.11; 'former,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.17; 'latter': 0.22; 'testing': 0.24; 'least': 0.25; 'header:In-Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'probably': 0.29; 'class': 0.29; "i'm": 0.29; 'fri,': 0.30; 'sense': 0.31; 'to:addr:python-list': 0.33; 'likely': 0.33; 'skip:d 20': 0.34; 'received:google.com': 0.34; 'clear': 0.35; 'nov': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'test': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'skip:l 20': 0.38; 'sure': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'think': 0.40; 'more': 0.63; 'confusion.': 0.84; 'say:': 0.84; 'do:': 0.91; 'hand,': 0.97
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:to :content-type; bh=ccX3WsvGXdDYXJtbWJMk1jh2f1UTy1Yjj+XjmAvVsQE=; b=lvhG/RY6VcczciNM8S4gU37qtK3GJcwgZPFKzE/mdAMcrv3jdDwJ/WmL7YlFIKvEqh pfPZHiYRSpTF+XTWNN+6nlaKkEZf4vr6p0wt7k2x5ISSZnYuVrvk+XZf3Y96ukgFMDtt F8AOxwOkJ0bxEy2otb9mdZ4l8COB9KwAoaXoa4BX2QPaXlOJwavlxMQqxeik8cu+ZjKz 9+Wn1C2NXG01SOE8TXh7lZY8destf5XuWjIRIDUY21/OLP4x2hPNDR/NY5gNUfqA8qmT ZWNqtSMlswczDmRAomjdScZ8QpnT31BbYZzzHkErtlpAWgNWIC/36B4H834A1rACS2sG eQPg==
MIME-Version 1.0
In-Reply-To <CALwzidnNvsPByrFgpDCZM0_vrtJ+g8_3HDMUw-wK+gXc2iEfxQ@mail.gmail.com>
References <mailman.3455.1352396166.27098.python-list@python.org> <509c412d$0$29980$c3e8da3$5496439d@news.astraweb.com> <CALwzidnNvsPByrFgpDCZM0_vrtJ+g8_3HDMUw-wK+gXc2iEfxQ@mail.gmail.com>
Date Fri, 9 Nov 2012 17:14:49 +1100
Subject Re: duck typing assert
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.3476.1352441691.27098.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1352441691 news.xs4all.nl 6855 [2001:888:2000:d::a6]:39689
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:32996

Show key headers only | View raw


On Fri, Nov 9, 2012 at 12:00 PM, Ian Kelly <ian.g.kelly@gmail.com> wrote:
> looks(Foo).like(IFoo), on the other hand, is crystal clear about which
> argument is which.

I'm not so sure that it is, tbh. If you read it like an English
sentence, it's clearly testing whether Foo matches the template in
IFoo, but which are you more likely to do: test one class to see if it
satisfies lots of templates, or test one template against every class
you meet? I think probably the latter is, if not more likely than the
former, at least sufficiently plausible as to create confusion. It
makes very good sense to say:

duckmatch(IFoo).compare(Foo)

ie with the arguments the other way.

ChrisA

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


Thread

duck typing assert‏ Andriy Kornatskyy <andriy.kornatskyy@live.com> - 2012-11-08 20:34 +0300
  Re: duck typing assert‏ Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-08 23:33 +0000
    Re: duck typing assert Ian Kelly <ian.g.kelly@gmail.com> - 2012-11-08 18:00 -0700
      Re: duck typing assert Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-09 13:36 +0000
        RE: duck typing assert Andriy Kornatskyy <andriy.kornatskyy@live.com> - 2012-11-09 17:01 +0300
        Re: duck typing assert Chris Angelico <rosuav@gmail.com> - 2012-11-10 01:15 +1100
        RE: duck typing assert Andriy Kornatskyy <andriy.kornatskyy@live.com> - 2012-11-09 17:37 +0300
    Re: duck typing assert Chris Angelico <rosuav@gmail.com> - 2012-11-09 17:14 +1100
    RE: duck typing assert Andriy Kornatskyy <andriy.kornatskyy@live.com> - 2012-11-09 13:26 +0300
    RE: duck typing assert "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-11-09 17:37 +0000
    RE: duck typing assert Andriy Kornatskyy <andriy.kornatskyy@live.com> - 2012-11-09 20:55 +0300

csiph-web