Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'languages,': 0.04; 'static': 0.04; 'argument': 0.05; 'compiler': 0.07; 'string': 0.09; 'arguments': 0.09; 'subject: [': 0.09; 'type,': 0.09; 'typed': 0.09; 'declaration': 0.16; 'for,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:"]': 0.16; 'demonstrate': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'thu,': 0.19; 'tests': 0.22; 'integer': 0.24; 'subject:problem': 0.24; 'tells': 0.24; 'least': 0.26; 'certain': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'said,': 0.30; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'getting': 0.31; '-0700,': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'there.': 0.32; 'languages': 0.32; 'supposed': 0.32; 'subject:with': 0.35; "can't": 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'error.': 0.37; 'unit': 0.37; 'wrong': 0.37; 'application': 0.37; 'two': 0.37; 'being': 0.38; 'to:addr:python-list': 0.38; 'that,': 0.38; 'does': 0.39; 'though,': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'catch': 0.60; 'helps': 0.61; 'first': 0.61; "you've": 0.63; 'subject:The': 0.64; 'more': 0.64; '30,': 0.65; 'between': 0.67; 'type(s)': 0.84; 'divided': 0.91; 'whereas': 0.91; '2013': 0.98 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=m8z0QBA7LsM2vytba9FjkRd8UcacQY3jSsNP2Oi3SAQ=; b=L6n6q2vfhTj4rAyhTUr7jm2v8FrHv9oX/UAAp0gqvvkhaddJDXnVvfK4oq4mL3LWWU wtHOVRrPIsq474lQ/Iid7LUQRYMd6Q6cHCDLDghAlzfE7ggj+z/gntTk7BS01U9Go7FX fYyz0qSleRNPNLdZSeV8pQX2CBftLyEA1lBUhW5/gPAQRoRyQ+sAWcX9527xO+eprRO3 9M6p+xKms2aHPFk7wpzmh7nhfsv7zfQXrdcUGfkoOERpAh1wd+crqnTnKlAwwYN84pBf lRxE5yo/Z7FCXm+c+oldVVLOvMjx12rElkwwUNiT35xDbz1RoCzl+w6fPZISnujy+TDQ t1Sg== MIME-Version: 1.0 X-Received: by 10.58.214.105 with SMTP id nz9mr7511554vec.58.1370485784918; Wed, 05 Jun 2013 19:29:44 -0700 (PDT) In-Reply-To: <51afec46$0$29966$c3e8da3$5496439d@news.astraweb.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <96cd7a31-40ce-4e51-9489-446b7f002a0e@googlegroups.com> <51afec46$0$29966$c3e8da3$5496439d@news.astraweb.com> Date: Thu, 6 Jun 2013 12:29:44 +1000 Subject: Re: Bools and explicitness [was Re: PyWart: The problem with "print"] 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: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1370485793 news.xs4all.nl 15917 [2001:888:2000:d::a6]:50178 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:47179 On Thu, Jun 6, 2013 at 11:56 AM, Steven D'Aprano wrote: > On Wed, 05 Jun 2013 14:59:31 -0700, Russ P. wrote: >> As for Python, my experience with it is that, as >> your application grows, you start getting confused about what the >> argument types are or are supposed to be. > > Whereas people never get confused about the arguments in static typed > languages? > > The only difference is whether the compiler tells you that you've passed > the wrong type, or your unit test tells you that you've passed the wrong > type. What, you don't have unit tests? Then how do you know that the code > does the right thing when passed data of the right type? Adding an extra > couple of unit tests is not that big a burden. The valid type(s) for an argument can be divided into two categories: Those the compiler can check for, and those the compiler can't check for. Some languages have more in the first category than others, but what compiler can prove that a string is an HTML-special-characters-escaped string? In a very few languages, the compiler can insist that an integer be between 7 and 30, but there'll always be some things you can't demonstrate with a function signature. That said, though, I do like being able to make at least *some* declaration there. It helps catch certain types of error. ChrisA