Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed2.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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'programmer': 0.03; 'languages,': 0.04; 'run-time': 0.05; 'strict': 0.07; 'subject: [': 0.09; 'subtle': 0.09; 'typed': 0.09; 'def': 0.12; 'bugs.': 0.16; 'declarations': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:"]': 0.16; 'types,': 0.16; 'language': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'basically': 0.19; 'typing': 0.19; 'necessary.': 0.24; 'subject:problem': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'assert': 0.31; 'proposing': 0.31; 'void': 0.31; 'option': 0.32; 'subject:with': 0.35; 'johnson': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'there': 0.35; 'should': 0.36; 'checks': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'around.': 0.60; "you're": 0.61; 'our': 0.64; 'subject:The': 0.64; 'bridge': 0.65; 'forced': 0.84; 'hate': 0.91; 'balances': 0.93; 'rick': 0.93; '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=wA0lyq0U9XG3YguuzA6clDeaSCoakmjWVO5bFmQBNPM=; b=gzwnP7GckM60JyJpfeYfJODqOC3G6TzUh7vV7TK4oy1L9FuhDijLxylMQ0fEff3yQA YBHMihm24rt4Q1PBUS/o7UDZKbbo3Wj4XvmnuLtUeoqYJM7XC6ekKiX/la/BIEQHON2L WwKA/JRE929ITx532RTnmd7uWqazgyCr0038fsPtYOdvdglgO2y1+YpCj5mJEhqaTD9g tvMucpi9NIBwYhavuIlLSzTLnr9WekbDgz/S6dMmVyy+2bw9X9bnf896fTH67aWGk1HO L7e3WUY3AdQqhtMaXpkrdwE4XWicS8I3plrQqr2Umfh5WuTZWq0RhRGGotP20CSiZHLh 2Qpg== MIME-Version: 1.0 X-Received: by 10.220.215.73 with SMTP id hd9mr19130523vcb.19.1370363246694; Tue, 04 Jun 2013 09:27:26 -0700 (PDT) In-Reply-To: References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> Date: Wed, 5 Jun 2013 02:27:26 +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: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1370363254 news.xs4all.nl 15866 [2001:888:2000:d::a6]:51075 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:46938 On Wed, Jun 5, 2013 at 2:19 AM, Rick Johnson wrote: > On Jun 4, 11:00 am, Chris Angelico wrote: >> You know, if you want a language with strict type declarations and >> extreme run-time efficiency, there are some around. > > I don't like declaring types everywhere, i hate it. I prefer duck > typed languages, HOWEVER, in order for duck typing to work > consistently you must have checks and balances that the programmer can > apply when he feels necessary. My "is_valid" built in will bridge the > gap. We won't be forced to declare types, but we should ALWAYS add > "type checks" to our "truth tests" unless we want to create subtle > bugs. "is_valid" IS the answer! Option 1: void C_function(int x) Option 2: def Python_function(x): assert isinstance(x,int) Is there a fundamental difference? You're basically proposing Option 2 while detesting Option 1. ChrisA