Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'else:': 0.03; 'explicit': 0.07; 'subject:code': 0.07; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; 'python': 0.11; '"can\'t': 0.16; './python': 0.16; 'bug:': 0.16; 'buggy': 0.16; 'roy': 0.16; 'run:': 0.16; 'subject:python': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'skip:e 30': 0.24; 'first,': 0.26; 'possibly': 0.26; 'header:In-Reply-To:1': 0.27; 'dec': 0.30; 'skip:( 20': 0.30; "i'm": 0.30; 'code': 0.31; 'assert': 0.31; "d'aprano": 0.31; 'raised': 0.31; 'steven': 0.31; 'linux': 0.33; 'classes': 0.35; 'there': 0.35; "i'll": 0.36; 'two': 0.37; 'list': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'even': 0.60; 'received:173': 0.61; 'more': 0.64; 'of:': 0.68; 'smith': 0.68; 'cut': 0.74; 'strategies': 0.77; 'fail.': 0.84; '2013,': 0.91 Date: Mon, 23 Dec 2013 04:38:23 -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: <52b7a0e4$0$29994$c3e8da3$5496439d@news.astraweb.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit 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]:51659 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: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1387805190 news.xs4all.nl 2840 [2001:888:2000:d::a6]:44123 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:62626 On 12/22/2013 06:33 PM, Steven D'Aprano wrote: > Roy Smith wrote: >> >> else: >> assert 0, "can't create picker (classes = %s)" % classes > > ¡Ay, caramba! I was with you until the very last line. The above code is > possibly buggy and inappropriately designed. [...] > > First, the bug: there are circumstances where no exception is raised even if > all the strategies fail. Since Steven wasn't explicit about the circumstances, I'll list the two I'm aware of: if Python is started with -O or -OO then assertions are cut from the code and do not run: ethan@media:~/source/python/issue19995$ ./python -O Python 3.4.0b1 (default:be22ffb4fdf1, Dec 20 2013, 12:26:10) [GCC 4.7.3] on linux Type "help", "copyright", "credits" or "license" for more information. --> assert 0, "Testing" --> # no exception raised