Path: csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.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.016 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'debugging': 0.07; 'occasionally': 0.09; 'raises': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '10:59': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'pressed': 0.16; 'traceback.': 0.16; 'prevent': 0.16; 'wrote:': 0.18; 'wed,': 0.18; '(in': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply- To:1': 0.27; 'tim': 0.29; 'dec': 0.30; 'statement': 0.30; 'waste': 0.30; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'accidentally': 0.31; 'chase': 0.31; 'perl': 0.31; 'anyone': 0.31; 'continuing': 0.33; 'could': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'cancel': 0.36; 'dies': 0.36; 'false': 0.36; 'subject:new': 0.38; 'pm,': 0.38; 'previous': 0.38; 'easy': 0.60; 'subject:"': 0.60; 'most': 0.60; 'complete': 0.62; 'fashion': 0.64; 'subject:else': 0.84; 'to:none': 0.92 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:cc :content-type; bh=2vF02sGBcHLKqT9GBDa+lrpbc+TMF9sPzZlxMBiHKMo=; b=eC+C8Mn715xQFfDZP3gfG5np/bN/E2Cx59oRH9Dh+qCiTzIAMdmaY/Ngi4xFLFQOSM jZj3bKYe9+jFjwshQD9r7z2mpJjUBfjgnOktBJtX4eBIYoJDDu2Lshm2mkKg68uaqZZu ViMP+zzgiAjm8IuvdX2xiFvvgbsvza/dWRgmwaYtfEOHdRu3wD2fXWTw35PkdZGPASzo jIefOIDRuJy0JjsMsdFPgQTIukbNBN2uEJHvuFVmdjdsGiVzc28GTyJ89xzRZ17juvj/ YkRJDn5LuRS4IP9o4Vx/bLhO3dcaYjJarFUJH/UpoUWZV+QVFWGwOSdpta7LZG7PqVeZ 2E1Q== MIME-Version: 1.0 X-Received: by 10.42.130.194 with SMTP id w2mr6807907ics.12.1417608496630; Wed, 03 Dec 2014 04:08:16 -0800 (PST) In-Reply-To: <20141203055928.03f8f191@bigbox.christie.dr> References: <1o2t7a5rt5j35lm8e5ad2811cpoupbs22f@4ax.com> <20141203055928.03f8f191@bigbox.christie.dr> Date: Wed, 3 Dec 2014 23:08:16 +1100 Subject: Re: Proposed new conditional operator: "or else" From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 1417608499 news.xs4all.nl 2972 [2001:888:2000:d::a6]:45790 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:81858 On Wed, Dec 3, 2014 at 10:59 PM, Tim Chase wrote: > On 2014-12-02 23:05, Dennis Lee Bieber wrote: >> > foo == 42 or else >> >> Has a PERL stink to it... like: foo == 42 or die > > This statement actually works in Python and I occasionally use it > when debugging (in the same fashion as one might do printf() > debugging in C). It raises a NameError and the program dies with a > traceback. Most frequently, it's to prevent the program from > continuing on to connect to a database and actually make changes. *gasp* But it's just as fragile as assert! Anyone could just put one line of code into your program and destroy all your debugging checks! die = False Your code has just been made immortal! This is *obviously* a complete waste of time, since it's that easy to defeat! > [sorry for the previous message if I failed to cancel the send that > happened when I accidentally pressed ctrl+enter...typing in the dark] It was its own joke. :) ChrisA