[FP] Rewriting name bindings as expressions

Michael Hudson mwh at python.net
Fri May 25 10:26:02 EDT 2001


"Alex Martelli" <aleaxit at yahoo.com> writes:

> "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]]

ans=[y+1for x in range(10)for y in[x*x]]

Cheers,
M.

-- 
  Slim Shady is fed up with your shit, and he's going to kill you.
                         -- Eminem, "Public Service Announcement 2000"



More information about the Python-list mailing list