Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.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.064 X-Spam-Evidence: '*H*': 0.87; '*S*': 0.00; 'subject:Python': 0.06; 'cc:addr:python-list': 0.11; 'jan': 0.12; 'thread': 0.14; '10:59': 0.16; '23,': 0.16; 'brilliant': 0.16; 'doctests': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'reedy': 0.16; 'sync': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'file,': 0.19; 'unlike': 0.19; '>>>': 0.22; 'putting': 0.22; 'separate': 0.22; 'tests': 0.22; 'cc:addr:python.org': 0.22; 'file.': 0.24; 'cc:2**0': 0.24; 'options': 0.25; 'header:In-Reply- To:1': 0.27; 'idea': 0.28; 'chris': 0.29; 'related': 0.29; 'especially': 0.30; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'stated.': 0.31; 'option': 0.32; 'another': 0.32; 'fri,': 0.33; 'could': 0.34; 'tool': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'two': 0.37; 'files': 0.38; 'pm,': 0.38; 'short': 0.38; 'does': 0.39; 'called': 0.40; 'cost.': 0.60; 'most': 0.60; 'break': 0.61; 'new': 0.61; 'costs': 0.63; 'worth': 0.66; 'hints': 0.68; 'line,': 0.68; 'real-world': 0.68; 'us,': 0.73; '2015': 0.84; 'compact,': 0.84; "everything's": 0.84; 'proposal.': 0.84; 'subject:Solution': 0.84; 'subject:Proposal': 0.91; 'to:none': 0.92 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:cc :content-type; bh=WQ/4IyrVM1My5r/6fd/W8xZAEx0u0NCtwKLtyfeIvj4=; b=g7+0YTTQkbPQyXIGcLJBnkitoIYAVi7RjiiBtQyhrf7A0XQBBwnYCBnpAhAaXN5lqz tLmai2G4T8GY9pQgCRh0YwX7AfGOLUoMWAWaUgQ9J50WHOzrkslJd7+U9ynJx9JzQacP T01/Nju59cIp+sXxIweiG4+y88Kc7nLjYovsZf9v9PQ2PO+rQIJoW8qszadOhfDBG4QK fRcQz38UzWMg77zDLx6AorEYBwYVlWO6h/JEFR3fHm6RmIcGFsnwPK/ShvcJKQnxdrCQ UkjC22YEbC8a0BSo3GXAefYKukF0tnUGW8ap1wOE/rkhmxHFwg1LZMcUQEReNBKXV7Lk kpvA== MIME-Version: 1.0 X-Received: by 10.224.128.196 with SMTP id l4mr10765716qas.100.1421991116062; Thu, 22 Jan 2015 21:31:56 -0800 (PST) In-Reply-To: References: <6da1eb58-a0bb-4d37-8293-0a8cafe6a89c@googlegroups.com> Date: Fri, 23 Jan 2015 16:31:55 +1100 Subject: Re: Python Sanity Proposal: Type Hinting Solution From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1421991118 news.xs4all.nl 2889 [2001:888:2000:d::a6]:34541 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:84317 On Fri, Jan 23, 2015 at 4:03 PM, Terry Reedy wrote: > On 1/22/2015 10:59 PM, Chris Angelico wrote: >> >> On Fri, Jan 23, 2015 at 2:22 PM, Terry Reedy wrote: >>> >>> This idea is so brilliant that it is already an option in mypy and is >>> part >>> of the new type-hint proposal. The separate type-hint files are called >>> 'stub files'. >> >> >> It's worth pointing out, too, that the idea isn't panaceaic - it's >> just another tool in the box. Any time you break related things into >> separate places, especially separate files, the tendency for them to >> get out of sync grows dramatically. > > > The same could be said of putting tests in a separate file. Yep. It's not a killer, but it does have a cost. That's one reason for doctests - to put the tests in with the code. Everything's a trade-off; with tests it's often better to put them in another file, but type hints are short and compact, and can be briefly stated. Unlike the complicated ones this thread has given us, most real-world ones will be short. So we have the option to put them in-line or out of line, and the two options have competing costs (readability vs code disconnect). ChrisA