Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #33027
| Path | csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!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.047 |
| X-Spam-Evidence | '*H*': 0.91; '*S*': 0.00; 'suppose': 0.07; 'unrecognized': 0.07; 'python': 0.09; '"class"': 0.09; 'sat,': 0.15; '(assuming': 0.16; '[1].': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.17; 'received:209.85.214.174': 0.21; 'header:In-Reply-To:1': 0.25; '[1]': 0.27; 'am,': 0.27; 'checking': 0.27; 'message- id:@mail.gmail.com': 0.27; 'fine': 0.28; 'post': 0.28; 'assert': 0.29; 'normally': 0.30; 'expect': 0.31; 'generally': 0.32; 'switch': 0.32; "who's": 0.32; 'problem': 0.33; 'to:addr:python- list': 0.33; 'that,': 0.34; 'received:google.com': 0.34; 'minimum': 0.34; 'nov': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'unable': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'skip:l 20': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'header:Received:5': 0.40; 'save': 0.61; "you'll": 0.62; '(that': 0.62; 'between': 0.63; 'legal': 0.65; 'hassle.': 0.84; 'offers.': 0.84; 'only:': 0.84; 'openings,': 0.91 |
| 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=V9lMERf9ndfQ+RpnUPCGRvfNCXtsweSEEHFWOExuM1g=; b=L8Sbv7tjwog3jNeJVERr+OJrefbV/nwgRc2ZrA8kXt27WFB4Rwj7NYQy6J6ERJiz2Y mUMsdula1IlSdapfogxi6H+vza/Mf3baUsHj5JuFOk0lb16sZr0JUjdhPyZEkoIzGYM3 gbjmJW90rGI0cSjMTWSatEvBkWC+MdWT2DwM5EeSRZWonch33Zw2FTC4RN/fI8sIl7Sj FWQSEnLEWJiIQZa38cll+e8TtAMVCyz+voWgX6cVOneFm8xufqrD5whnjwAS9XRh+tgx 4hmW+om27PjG8kJUFskrhqO/GdlK74Ubesn2tT6h1MUy+zQ3d8jh10aCNZzR+sNpJaGy yiRQ== |
| MIME-Version | 1.0 |
| In-Reply-To | <DUB117-W135838CDCA85E153BDDC1F991680@phx.gbl> |
| References | <mailman.3455.1352396166.27098.python-list@python.org> <509c412d$0$29980$c3e8da3$5496439d@news.astraweb.com> <mailman.3470.1352422891.27098.python-list@python.org> <509d06e7$0$29980$c3e8da3$5496439d@news.astraweb.com> <DUB117-W135838CDCA85E153BDDC1F991680@phx.gbl> |
| Date | Sat, 10 Nov 2012 01:15:36 +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.3494.1352470546.27098.python-list@python.org> (permalink) |
| Lines | 28 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1352470546 news.xs4all.nl 6979 [2001:888:2000:d::a6]:55581 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:33027 |
Show key headers only | View raw
On Sat, Nov 10, 2012 at 1:01 AM, Andriy Kornatskyy <andriy.kornatskyy@live.com> wrote: > > 1. In looks-like we check features of Foo (that may be superset) of what IFoo offers. > > assert looks(Foo).like(IFoo) > > 2. We can check if Foo is limited to IFoo only: > > assert looks(IFoo).like(Foo) > > So it valid to have both asserts. You'll almost never need #2, but since there's no difference between a "class" and an "interface", it's perfectly legal to switch them around. But I would generally expect that unrecognized methods are never a problem (assuming they don't collide with anything) - that, as in Steven's example, it's fine to have an actor who can sing when you don't need her to. When you post job openings, you don't normally ask for someone with "5+ years Python experience and unable to program in REXX" [1]. You're checking for a minimum set of requirements. [1] Though I suppose you might ask for someone who's unable to program in Pascal. Might save you some hassle. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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