Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.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.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; '"or': 0.09; 'definition,': 0.09; 'don': 0.09; 'happen,': 0.09; 'cc:addr:python-list': 0.11; 'thread': 0.14; '"assert"': 0.16; '-tkc': 0.16; 'else"': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'gonna': 0.16; 'received:10.216': 0.16; 'roy': 0.16; ':-)': 0.16; 'language': 0.16; 'wrote:': 0.18; '(not': 0.18; '(in': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply- To:1': 0.27; 'am,': 0.29; 'raise': 0.29; 'words': 0.29; 'dec': 0.30; 'statement': 0.30; 'assert': 0.31; 'could': 0.34; "can't": 0.35; 'but': 0.35; 'received:10': 0.37; 'subject:new': 0.38; 'even': 0.60; 'subject:"': 0.60; 'for:': 0.64; 'to:addr:gmail.com': 0.65; 'it!': 0.67; 'optimized': 0.68; 'smith': 0.68; 'subject:else': 0.84; 'ware': 0.91; 'write:': 0.91 X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-MC-Relay: Neutral X-MailChannels-SenderId: wwwh|x-authuser|tim@thechases.com X-MailChannels-Auth-Id: wwwh X-MC-Loop-Signature: 1417544851181:422902027 X-MC-Ingress-Time: 1417544851181 Date: Tue, 2 Dec 2014 12:30:00 -0600 From: Tim Chase To: Zachary Ware Subject: Re: Proposed new conditional operator: "or else" In-Reply-To: References: X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-AuthUser: tim@thechases.com Cc: Python 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: 1417544855 news.xs4all.nl 2926 [2001:888:2000:d::a6]:37299 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:81808 On 2014-12-02 11:41, Zachary Ware wrote: > On Tue, Dec 2, 2014 at 11:18 AM, Roy Smith wrote: > > Wouldn=E2=80=99t it be neat to write: > > > > foo =3D=3D 42 or else > > > > and have that be an synonym for: > > > > assert foo =3D=3D 42 > > > > :-) >=20 > Never going to happen, but I like it! Perhaps raise > IntimidationError instead of AssertionError when it fails? In light of the parallel thread discussing the "assert" statement and the perils of trusting it to be present even though it can be optimized away, this "or else" could be (in the altered words of Don Corleone), "I'm gonna make an assertion he can't refuse." (not that I particularly want/expect this in the language definition, but it's fun to entertain the idea) -tkc