Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #61201
| Date | 2013-12-06 17:20 -0700 |
|---|---|
| From | Michael Torrie <torriem@gmail.com> |
| Subject | Re: One liners |
| References | <CAGGBd_o1TS02cosi+q9YeN5rnWJxe5mU7xtCTuTMZGO0ntF5TA@mail.gmail.com> <52A26763.3070803@gmail.com> <CAGGBd_rsP3rU6X30W_ocF8vNrPrLBrivT+nCv-1htgehmPZWrg@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3678.1386375653.18130.python-list@python.org> (permalink) |
On 12/06/2013 05:14 PM, Dan Stromberg wrote: > I'm thinking mostly of stackoverflow, but here's an example I ran into (a > lot of) on a job: > > somevar = some_complicated_thing(somevar) if > some_other_complicated_thing(somevar) else somevar > > Would it really be so bad to just use an if statement? Why are we > assigning somevar to itself? This sort of thing was strewn across 3 or 4 > physical lines at a time. You're right that a conventional "if" block is not only more readable, but also faster and more efficient code. Sorry you have to deal with code written like that! That'd frustrate any sane programmer. It might bother me enough to write code to reformat the program to convert that style to something sane! There are times when the ternary (did I get that right?) operator is useful and clear.
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: One liners Michael Torrie <torriem@gmail.com> - 2013-12-06 17:20 -0700
Re: One liners Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-12-07 02:28 +0000
Re: One liners Chris Angelico <rosuav@gmail.com> - 2013-12-07 13:40 +1100
Re: One liners Roy Smith <roy@panix.com> - 2013-12-06 22:27 -0500
Re: One liners Chris Angelico <rosuav@gmail.com> - 2013-12-07 15:06 +1100
Re: One liners Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-12-07 11:27 +0000
Re: One liners Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-12-07 14:41 +0200
Re: One liners Rotwang <sg552@hotmail.co.uk> - 2013-12-07 16:13 +0000
Re: One liners Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-12-07 16:25 +0000
Re: One liners Rotwang <sg552@hotmail.co.uk> - 2013-12-08 02:23 +0000
Re: One liners Michael Torrie <torriem@gmail.com> - 2013-12-07 09:26 -0700
Re: One liners Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-12-07 19:49 +0200
Re: One liners Terry Reedy <tjreedy@udel.edu> - 2013-12-07 16:02 -0500
Re: One liners Michael Torrie <torriem@gmail.com> - 2013-12-07 09:56 -0700
Re: One liners rusi <rustompmody@gmail.com> - 2013-12-07 09:10 -0800
Re: One liners Michael Torrie <torriem@gmail.com> - 2013-12-07 10:02 -0700
csiph-web