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


Groups > comp.lang.python > #63032

Re: Ifs and assignments

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'from:addr:yahoo.co.uk': 0.04; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'wrapper': 0.09; 'def': 0.12; 'jan': 0.12; 'language.': 0.14; 'cleaner': 0.16; 'dig': 0.16; 'handler,': 0.16; 'perfect.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'roy': 0.16; 'true:': 0.16; 'language': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'certainly': 0.24; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'function': 0.29; 'chris': 0.29; 'code': 0.31; 'fri,': 0.33; 'but': 0.35; 'var': 0.36; 'yield': 0.36; 'turn': 0.37; 'generic': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'rather': 0.38; 'itself': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'break': 0.61; 'kind': 0.63; 'our': 0.64; 'smith': 0.68; 'thoroughly': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: Ifs and assignments
Date Fri, 03 Jan 2014 04:29:49 +0000
References <52C59FF6.5000607@allsup.co> <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>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host host-78-147-28-22.as13285.net
User-Agent Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.2.0
In-Reply-To <CAPTjJmrhG3j-dByy14_O5KeBrCVbBnSbnWDhRLyusH+DsoxnSQ@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4829.1388723405.18130.python-list@python.org> (permalink)
Lines 36
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1388723405 news.xs4all.nl 2845 [2001:888:2000:d::a6]:43900
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:63032

Show key headers only | View raw


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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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