[FP] Rewriting name bindings as expressions
Duncan Booth
duncan at NOSPAMrcp.co.uk
Fri May 25 09:07:22 EDT 2001
richardd at pobox.com (Richard Davies) wrote in
news:5078c6cc.0105250437.6670f5d9 at posting.google.com:
> z = let y = x+1 in y+y*y
>
> becomes
>
> z = [y+y*y for y in x+1,][0]
>
> which is good, but could be nicer if we never had to
> bring lists into it...
>
>
Doesn't this just become [z for y in x+1, for z in y+y*y,] ?
Where of course the first z could be anything you like.
--
Duncan Booth duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?
More information about the Python-list
mailing list