Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'explicit': 0.07; '"or': 0.09; 'executed': 0.09; 'false.': 0.09; 'happen,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'else"': 0.16; 'evaluates': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'roy': 0.16; ':-)': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'this:': 0.26; 'header:X-Complaints-To:1': 0.27; 'am,': 0.29; 'raise': 0.29; 'dec': 0.30; 'statement': 0.30; 'assert': 0.31; 'guess': 0.33; 'but': 0.35; 'false': 0.36; 'should': 0.36; 'subject:new': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'subject:"': 0.60; 'for:': 0.64; 'it!': 0.67; 'smith': 0.68; 'subject:else': 0.84; 'ware': 0.91; 'write:': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Sturla Molden Subject: Re: Proposed new conditional operator: "or else" Date: Wed, 3 Dec 2014 00:54:26 +0000 (UTC) References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: 211-185-11.connect.netcom.no User-Agent: NewsTap/4.0.1 (iPad) X-: 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: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1417568083 news.xs4all.nl 2895 [2001:888:2000:d::a6]:44350 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:81821 Zachary Ware wrote: > On Tue, Dec 2, 2014 at 11:18 AM, Roy Smith wrote: >> Wouldn’t it be neat to write: >> >> foo == 42 or else >> >> and have that be an synonym for: >> >> assert foo == 42 >> >> :-) > > Never going to happen, but I like it! Perhaps raise IntimidationError > instead of AssertionError when it fails? I guess the "or else" statement should do this: or else where the statement is executed if the statement evaluates to false. In absence of an explicit threat or else it should raise IntimidationError if evaluates to false false. If evaluates to true it should just return . Sturla