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: 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: References: <8D03F2B8CF0E7BE-1864-1796B@webmail-m103.sysops.aol.com> From: Joshua Landau Date: Tue, 25 Jun 2013 10:10:30 +0100 Subject: Re: Is this PEP-able? fwhile To: python-list 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On 24 June 2013 23:50, Chris Angelico 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.