[FP] Rewriting name bindings as expressions
Alex Martelli
aleaxit at yahoo.com
Fri May 25 09:37:59 EDT 2001
"Richard Davies" <richardd at pobox.com> wrote in message
news:5078c6cc.0105250429.6830c1eb at posting.google.com...
> > ans = [y+1 for x in range(10) for y in (x*x,)]
...
> ans = [y+1 for x in range(10) for y in x*x,]
>
> are a few characters shorter!
If saving characters is the game, skip unneded spaces:
ans=[y+1 for x in range(10)for y in[x*x]]
that space between ')' and 'for' is such a waste...!
Alex
More information about the Python-list
mailing list