Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3.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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:code': 0.07; 'exception.': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'http': 0.09; 'message-id:@stoneleaf.us': 0.09; '~ethan~': 0.09; 'django': 0.11; 'mostly': 0.14; "(i'm": 0.16; 'dump': 0.16; 'middleware': 0.16; 'received:69.93': 0.16; 'roy': 0.16; 'worse.': 0.16; 'subject:python': 0.16; 'exception': 0.16; 'followed': 0.16; ':-)': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'trying': 0.19; 'pieces': 0.19; 'stack': 0.19; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'features,': 0.24; '(or': 0.24; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'function': 0.29; 'feature': 0.29; 'am,': 0.29; "i'm": 0.30; '>>>>': 0.31; 'assert': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'trace': 0.31; 'figure': 0.32; 'running': 0.33; 'checking': 0.33; 'comment': 0.34; 'test': 0.35; 'doing': 0.36; 'charset:us-ascii': 0.36; 'should': 0.36; 'clear': 0.37; 'easily': 0.37; 'sometimes': 0.38; 'somebody': 0.38; 'to:addr:python-list': 0.38; 'list,': 0.38; 'pm,': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'major': 0.40; 'skip:u 10': 0.60; 'hope': 0.61; 'received:173': 0.61; "you're": 0.61; 'more': 0.64; 'yes': 0.68; 'smith': 0.68; 'strategies': 0.77; 'article': 0.77; 'ethan': 0.84; 'furman': 0.84; 'happened.': 0.84; 'received:gateway15.websitewelcome.com': 0.84; 'confidence': 0.95 Date: Mon, 23 Dec 2013 08:00:12 -0800 From: Ethan Furman User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: cascading python executions only if return code is 0 References: <52b782db$0$6599$c3e8da3$5496439d@news.astraweb.com> <52b7a0e4$0$29994$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3304.hostgator.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stoneleaf.us X-BWhitelist: no X-Source-IP: 173.12.184.233 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([173.12.184.233]) [173.12.184.233]:52142 X-Source-Auth: ethan+stoneleaf.us X-Email-Count: 1 X-Source-Cap: dG9idWs7dG9idWs7Z2F0b3IzMzA0Lmhvc3RnYXRvci5jb20= 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: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1387819120 news.xs4all.nl 2931 [2001:888:2000:d::a6]:52074 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:62641 On 12/23/2013 07:10 AM, Roy Smith wrote: > In article , > Ethan Furman wrote: > >> On 12/22/2013 08:57 PM, Roy Smith wrote: >>> In article <52b7a0e4$0$29994$c3e8da3$5496439d@news.astraweb.com>, >>> Steven D'Aprano wrote: >>> >>>> Anyway, I may be completely misinterpreting what I'm reading. Perhaps the >>>> assertion is checking a function invariant ("one of the strategies will >>>> always succeed") in which case you're doing it exactly right and I should >>>> shut up now :-) >>> >>> Yes :-) >>> >>> More specifically, the assertion exception will get caught way up in >>> some django middleware which will log a stack trace and return a HTTP >>> 50-something. This will typically be followed by somebody like me >>> noticing the stack dump and trying to figure out WTF happened. >> >> This is completely misusing what assertions are for. I hope this bit of >> middleware (or django itself) is very clear >> about never running with assertions turned off. > > Sigh. Sometimes I'm not sure which is worse. The anti-assertion > zealotry on this list, or the anti-regex zealotry. I am not a zealot (I'm not! Really!! ;) . I just find it alarming to have major pieces of software rely on a feature that can be so easily tuned out, and it wasn't clear from your comment that it was /any/ exception. Mostly I don't want newbies thinking "Hey! I can use assertions for all my confidence testing!" Just as one data point OpenERP, which has a lot of good features, unfortunately uses assert to test user input. :( -- ~Ethan~