Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81821 > unrolled thread
| Started by | Sturla Molden <sturla.molden@gmail.com> |
|---|---|
| First post | 2014-12-03 00:54 +0000 |
| Last post | 2014-12-03 00:54 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Proposed new conditional operator: "or else" Sturla Molden <sturla.molden@gmail.com> - 2014-12-03 00:54 +0000
| From | Sturla Molden <sturla.molden@gmail.com> |
|---|---|
| Date | 2014-12-03 00:54 +0000 |
| Subject | Re: Proposed new conditional operator: "or else" |
| Message-ID | <mailman.16505.1417568083.18130.python-list@python.org> |
Zachary Ware <zachary.ware+pylist@gmail.com> wrote: > On Tue, Dec 2, 2014 at 11:18 AM, Roy Smith <roy@panix.com> 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: <condition> or else <threat> where the statement <threat> is executed if the statement <condition> evaluates to false. In absence of an explicit threat <condition> or else it should raise IntimidationError if <condition> evaluates to false false. If <condition> evaluates to true it should just return <conditon>. Sturla
Back to top | Article view | comp.lang.python
csiph-web