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: 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: References: <509c412d$0$29980$c3e8da3$5496439d@news.astraweb.com> Date: Fri, 9 Nov 2012 17:14:49 +1100 Subject: Re: duck typing assert From: Chris Angelico 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Fri, Nov 9, 2012 at 12:00 PM, Ian Kelly 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