Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #81806

Re: Proposed new conditional operator: "or else"

Path csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ethan@stoneleaf.us>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.062
X-Spam-Evidence '*H*': 0.88; '*S*': 0.01; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'happen,': 0.09; 'message-id:@stoneleaf.us': 0.09; '~ethan~': 0.09; 'filename:fname piece:signature': 0.16; 'roy': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'header:In-Reply- To:1': 0.27; 'rest': 0.29; 'am,': 0.29; 'raise': 0.29; 'dec': 0.30; 'lines': 0.31; 'assert': 0.31; 'but': 0.35; 'raising': 0.36; 'subject:new': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'subject:"': 0.60; 'received:173': 0.61; 'for:': 0.64; 'it!': 0.67; 'smith': 0.68; 'surrounding': 0.68; 'subject:else': 0.84; 'ware': 0.91; 'write:': 0.91
Date Tue, 02 Dec 2014 10:06:29 -0800
From Ethan Furman <ethan@stoneleaf.us>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0
MIME-Version 1.0
To python-list@python.org
Subject Re: Proposed new conditional operator: "or else"
References <C2BEED98-4CCA-4EDE-8FDF-F235B478055C@panix.com> <CAKJDb-NpPbsHgQw5PVtjyK352=zuSBeXJD_+dH5GH3niQDaSOQ@mail.gmail.com>
In-Reply-To <CAKJDb-NpPbsHgQw5PVtjyK352=zuSBeXJD_+dH5GH3niQDaSOQ@mail.gmail.com>
Content-Type multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="qu3cI10cocEvXc3Tgn09BNqbq8f1EtvIx"
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.16497.1417543599.18130.python-list@python.org> (permalink)
Lines 50
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1417543599 news.xs4all.nl 2862 [2001:888:2000:d::a6]:55076
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:81806

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On 12/02/2014 09:41 AM, 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?

As long as when raising Intimidation, it also roughs up a couple surrounding lines as a warning to the rest of the code...

--
~Ethan~

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Proposed new conditional operator: "or else" Ethan Furman <ethan@stoneleaf.us> - 2014-12-02 10:06 -0800

csiph-web