Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!feeds.phibee-telecom.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.041 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'cc:addr:python-list': 0.11; 'article.': 0.16; 'cc:name:python list': 0.16; 'to:addr:pearwood.info': 0.16; 'to:addr:steve+comp.lang.python': 0.16; "to:name:steven d'aprano": 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'post': 0.26; 'header :In-Reply-To:1': 0.27; 'am,': 0.29; 'raise': 0.29; 'message- id:@mail.gmail.com': 0.30; "d'aprano": 0.31; 'steven': 0.31; 'fri,': 0.33; 'received:google.com': 0.35; 'subject:?': 0.36; 'url:org': 0.36; 'should': 0.36; 'read': 0.60; 'mar': 0.68; 'url:676': 0.84 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 :cc:content-type; bh=3FPRQWAWe7d3XJhIhnfZ755pXs9inPRcxCxQ6SKO3o0=; b=Yf6GscTX3bayk/1JodUUuecQVBvJAMOkSbLvoAWTGalrZh+icvzUHPJTsIFnf5UHK6 tMDjZhjQfI3XTH5KUicS4r/Mdz199AwVWK3maXD9jldmdf5gCooP3cJ8Q58iqVo5FK/y o94EsN7vpTCj8CdQ0+EkMZDnyD1irojs89nYhUPW23tDFD9hrhvY++D8L9HwWIPCstYt 9tWYtFin/SkIf+Y1/8rKDsxVLfw1oiFbuSVnQOiiEsKcBdrkdsjJ22YsnV6mzOR4I3FY epuebL3mnDC+WYxcdCx2W3j2jj7M44HEZ9NI3KpF3qbUlnR8CsS4wy7EuyJVvOgFwYqn rN5A== MIME-Version: 1.0 X-Received: by 10.180.106.40 with SMTP id gr8mr767231wib.31.1394237736536; Fri, 07 Mar 2014 16:15:36 -0800 (PST) In-Reply-To: <5319a975$0$29985$c3e8da3$5496439d@news.astraweb.com> References: <5319a975$0$29985$c3e8da3$5496439d@news.astraweb.com> Date: Fri, 7 Mar 2014 16:15:36 -0800 Subject: Re: Assertions are bad, m'kay? From: Dan Stromberg To: "Steven D'Aprano" Content-Type: text/plain; charset=ISO-8859-1 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: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1394237738 news.xs4all.nl 2851 [2001:888:2000:d::a6]:47143 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:68009 On Fri, Mar 7, 2014 at 3:11 AM, Steven D'Aprano wrote: > > Assertions are not bad! They're just misunderstood and abused. > You should read this guy's blog post on when to use assert: > > http://import-that.dreamwidth.org/676.html Nice article. BTW, what about: if value >= 3: raise AssertionError('value must be >= 3') ?