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


Groups > comp.lang.python > #81858 > unrolled thread

Re: Proposed new conditional operator: "or else"

Started byChris Angelico <rosuav@gmail.com>
First post2014-12-03 23:08 +1100
Last post2014-12-03 23:08 +1100
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.


Contents

  Re: Proposed new conditional operator: "or else" Chris Angelico <rosuav@gmail.com> - 2014-12-03 23:08 +1100

#81858 — Re: Proposed new conditional operator: "or else"

FromChris Angelico <rosuav@gmail.com>
Date2014-12-03 23:08 +1100
SubjectRe: Proposed new conditional operator: "or else"
Message-ID<mailman.16533.1417608499.18130.python-list@python.org>
On Wed, Dec 3, 2014 at 10:59 PM, Tim Chase
<python.list@tim.thechases.com> 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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web