Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #63032
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Subject | Re: Ifs and assignments |
| Date | 2014-01-03 04:29 +0000 |
| References | (1 earlier) <mailman.4816.1388709915.18130.python-list@python.org> <52c62fa8$0$30001$c3e8da3$5496439d@news.astraweb.com> <mailman.4823.1388720985.18130.python-list@python.org> <roy-9D0E6B.23144702012014@news.panix.com> <CAPTjJmrhG3j-dByy14_O5KeBrCVbBnSbnWDhRLyusH+DsoxnSQ@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4829.1388723405.18130.python-list@python.org> (permalink) |
On 03/01/2014 04:25, Chris Angelico wrote: > On Fri, Jan 3, 2014 at 3:14 PM, Roy Smith <roy@panix.com> wrote: >> Or turn it into a generator: >> That certainly makes your mainline code cleaner... > > Cleaner perhaps, but not clearer. Instead of seeing the original > function (say, a database retrieve-next call), you see a wrapper and > have to go dig to find out what it's actually doing. Unless it's some > kind of generic handler, like: > > def funcinator(func,*args): > while True: > var = func(*args) > if var: > yield var > else: > break > > while funcinator(cur.getnext): > .... > > But even that would be problematic until it got so thoroughly > understood that it's like enumerate() - which is itself still not > perfect. > > ChrisA > I find the above rather funcy :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Ifs and assignments Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-01-02 19:45 -0500
Re: Ifs and assignments Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-01-03 14:33 +1100
Re: Ifs and assignments Chris Angelico <rosuav@gmail.com> - 2014-01-03 14:49 +1100
Re: Ifs and assignments Roy Smith <roy@panix.com> - 2014-01-02 23:14 -0500
Re: Ifs and assignments Chris Angelico <rosuav@gmail.com> - 2014-01-03 15:25 +1100
Re: Ifs and assignments Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-01-03 04:29 +0000
Re: Ifs and assignments Duncan Booth <duncan.booth@invalid.invalid> - 2014-01-03 15:46 +0000
Re: Ifs and assignments Chris Angelico <rosuav@gmail.com> - 2014-01-03 14:55 +1100
Re: Ifs and assignments Roy Smith <roy@panix.com> - 2014-01-02 23:00 -0500
Re: Ifs and assignments Chris Angelico <rosuav@gmail.com> - 2014-01-03 15:08 +1100
csiph-web