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


Groups > comp.lang.python > #81857

Re: Proposed new conditional operator: "or else"

Date 2014-12-03 05:59 -0600
From Tim Chase <python.list@tim.thechases.com>
Subject Re: Proposed new conditional operator: "or else"
References <C2BEED98-4CCA-4EDE-8FDF-F235B478055C@panix.com> <1o2t7a5rt5j35lm8e5ad2811cpoupbs22f@4ax.com>
Newsgroups comp.lang.python
Message-ID <mailman.16532.1417608313.18130.python-list@python.org> (permalink)

Show all headers | View raw


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.

I've grown up a bit and usually use pdb.set_trace() now, but it's
still in my grab-bag of tools.

-tkc


[sorry for the previous message if I failed to cancel the send that
happened when I accidentally pressed ctrl+enter...typing in the dark]


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


Thread

Re: Proposed new conditional operator: "or else" Tim Chase <python.list@tim.thechases.com> - 2014-12-03 05:59 -0600

csiph-web