Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.018 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; '"this': 0.03; 'annotations': 0.09; 'occasionally': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'awesome.': 0.16; 'roy': 0.16; 'string)': 0.16; 'to:addr:pearwood.info': 0.16; 'to:addr:steve+comp.lang.python': 0.16; "to:name:steven d'aprano": 0.16; 'url:peps': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'code.': 0.18; 'things.': 0.19; '>>>': 0.22; 'aug': 0.22; 'cc:addr:python.org': 0.22; 'days,': 0.24; 'url:dev': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'feature': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'checking.': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'url:python': 0.33; 'cases': 0.33; 'checking': 0.33; 'fri,': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'there': 0.35; 'url:org': 0.36; 'two': 0.37; 'implement': 0.38; 'short': 0.38; 'everybody': 0.60; 'august': 0.61; 'simple': 0.61; 'real': 0.63; 'such': 0.63; 'relatively': 0.65; 'world': 0.66; 'nobody': 0.68; 'smith': 0.68; 'article': 0.77; 'indicator': 0.91; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=Ci++q8d+wEfPG8DWC3Jba4FKgIiMftEuYXg0LuX/cHM=; b=i0T/gK0m2yIWSY1dRwfLPR7J+wMND/p0jncQiIidlNAYZZeuJebMuUNGrDi7IFjpu2 XhLFvIHI5dTG32Xh1oqzE009FD/3FqeHW3hY8RPkZti8w6WdTeDLH0Blt0Ezv06ExxxJ xueT0WrH+Gbrl/YsxDY8B8V+IHy3bfz1knFiYrI7Hy4qqDYcE29Qro5L9qof+v4A64qO IQ6wbvowCnUiMLL/OMoIPltF3BpguPGRWieBsj6aMrvBCfaxpJTAY+KpHmW4dTQTYJ3N k8kAGHo1VqkuvDdmG9fyE4rjfAnDZIOn575F8dqAFjsKtryOrKChCOpDKU9FMBBZW4Il 9O2g== X-Received: by 10.152.88.74 with SMTP id be10mr14445674lab.4.1377991178023; Sat, 31 Aug 2013 16:19:38 -0700 (PDT) MIME-Version: 1.0 Sender: joshua.landau.ws@gmail.com In-Reply-To: <5221352b$0$6599$c3e8da3$5496439d@news.astraweb.com> References: <52200699$0$6599$c3e8da3$5496439d@news.astraweb.com> <5221352b$0$6599$c3e8da3$5496439d@news.astraweb.com> From: Joshua Landau Date: Sun, 1 Sep 2013 00:18:54 +0100 X-Google-Sender-Auth: mPveqWDMdYeSW62yGYX4cK91ofg Subject: Re: Interface and duck typing woes To: "Steven D'Aprano" Content-Type: text/plain; charset=UTF-8 Cc: python-list 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: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1377991186 news.xs4all.nl 15986 [2001:888:2000:d::a6]:40422 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:53379 On 31 August 2013 01:13, Steven D'Aprano wrote: > On Fri, 30 Aug 2013 06:35:47 -0400, Roy Smith wrote: > >> In article <52200699$0$6599$c3e8da3$5496439d@news.astraweb.com>, >> Steven D'Aprano wrote: >> >>> These days, it would be relatively simple to implement pre- and post- >>> condition checking using decorators, and indeed one of the motivating >>> use- cases for function annotations in Python 3 is to allow such >>> things. >>> >>> http://www.python.org/dev/peps/pep-3107/ >>> >>> (Function annotations are perhaps the best Python feature that nobody >>> uses.) >> >> This is awesome. > > Heh, everybody has one of two reactions: > > "This is awesome!" > > "You'll add type checking to my Python code over my dead body!!!" > > But I'm still to see a practical use for annotations in real world code. > Or indeed to think of a use for them other than type checking. I occasionally use them for documentation. I think that there some are cases where the return type (encoded as a string) is as good an indicator of functionality as a short docstring, so use both.