Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #49142
| References | (1 earlier) <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 | 2013-06-25 10:10 +0100 |
| Subject | Re: Is this PEP-able? fwhile |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3805.1372151473.3114.python-list@python.org> (permalink) |
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
Re: Is this PEP-able? fwhile Joshua Landau <joshua.landau.ws@gmail.com> - 2013-06-25 10:10 +0100
csiph-web