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


Groups > comp.lang.python > #49142

Re: Is this PEP-able? fwhile

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <joshua.landau.ws@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.094
X-Spam-Evidence '*H*': 0.83; '*S*': 0.01; 'languages,': 0.04; 'model,': 0.05; 'subject:PEP': 0.07; 'decorator': 0.09; 'python': 0.11; 'def': 0.12; 'omitting': 0.16; 'rule.': 0.16; 'wrote:': 0.18; 'lets': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'message-id:@mail.gmail.com': 0.30; 'stuff': 0.32; 'to:name :python-list': 0.33; 'actual': 0.34; 'maybe': 0.34; 'could': 0.34; 'received:google.com': 0.35; 'there': 0.35; 'are,': 0.36; 'implement': 0.38; 'to:addr:python-list': 0.38; 'rather': 0.38; 'little': 0.38; 'to:addr:python.org': 0.39; 'subject:? ': 0.60; 'new': 0.61; 'simply': 0.61; 'skip:n 10': 0.64; 'more': 0.64; 'here': 0.66; 'lose': 0.68; 'of:': 0.68; 'gain': 0.79; 'subject:this': 0.83; 'afford': 0.91; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=aN0napD7dXqmNx/h+2lqkXyMAOqCOG9x+OEKAcraIL4=; b=m/s+ylgWZc2QlAquZo+LS5ctaHee1hrFCBtZqlaIfbveJXajso0OlQR+yCL6wOIXhB w3k/RR/QCGGQv6Ztg3lcL5f/oSIQbv+wn7v5KEWZv4z629Mcr9x9XZBfZ6VRK7yasavO w9frB7N48UCO4TnrvU6cyxjEeOD7ZHsacwFgI7hRS1URhQf2VvZf3F08HylGLvsdnXXT UvNKvegrRtUSlDygRH4cBGUrFGIGm3Z55AABykWF0dfaW8+xueOMl05cBGbef3r5qJ+e sDXw4lMe3bPw8HgC4hVaolZsfA3lzWcwniu70vszpqGDqcwSHGerj8DtKH7ksh0MQHPb HL/A==
X-Received by 10.152.45.65 with SMTP id k1mr13182537lam.78.1372151470299; Tue, 25 Jun 2013 02:11:10 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <CAPTjJmqEWs=hnZB=cRCWMSjJ_fZ=fwnf8eJfc5UTAtH_MoTKWw@mail.gmail.com>
References <8D03F2B8CF0E7BE-1864-1796B@webmail-m103.sysops.aol.com> <CAA=1kxR65wqgQWQJaLvP2yx_XacEMsHiFs40rPW1UbFXYpnytA@mail.gmail.com> <CALwzidnADsCdNmfFsLChVq7bt9G87Rsr1DsD1M-jNmzqQ2Z0eA@mail.gmail.com> <CAA=1kxR2JU7tbNdr9smZd9=Cy-vSCwoaAzwM=6LiAZ3edzrF8A@mail.gmail.com> <CALwzid=4_dicyJ4RAFZ=vAXMTkvPqiauWoyfqjr7frFnaEXatA@mail.gmail.com> <CAPTjJmqEWs=hnZB=cRCWMSjJ_fZ=fwnf8eJfc5UTAtH_MoTKWw@mail.gmail.com>
From Joshua Landau <joshua.landau.ws@gmail.com>
Date Tue, 25 Jun 2013 10:10:30 +0100
Subject Re: Is this PEP-able? fwhile
To python-list <python-list@python.org>
Content-Type text/plain; charset=UTF-8
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 <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3805.1372151473.3114.python-list@python.org> (permalink)
Lines 37
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1372151473 news.xs4all.nl 15891 [2001:888:2000:d::a6]:33993
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:49142

Show key headers only | View raw


On 24 June 2013 23:50, Chris Angelico <rosuav@gmail.com> wrote:
>
> In more free-form languages, I implement this by simply omitting a line-break:
...
> Python could afford to lose a little rigidity here rather than gain
> actual new syntax:
>
> for i in range(10): if i%3:
>     print(i)
>
> And there you are, the for-if "filtered iteration" model, just by
> relaxing one rule.

Maybe rather:

    for i in range(10); if i%3:
        print(i)


One of the awesomer things about Coffeescript is:

    decorator = (f) -> (args...) -> f(args[0])

Which lets you do stuff like:

    recursive = do -> r = (n) ->
        if n > 0 then n*r(n-1) else 1

instead of:

    def recursive_gen():
        def recursive(n):
            return n*recursive(n-1) if n > 0 else 1
        return recursive
    recursive = recursive_gen()

Of course, Coffeescript has its own quirks.

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


Thread

Re: Is this PEP-able? fwhile Joshua Landau <joshua.landau.ws@gmail.com> - 2013-06-25 10:10 +0100

csiph-web