[FP] Rewriting name bindings as expressions

Alex Martelli aleaxit at yahoo.com
Fri May 25 11:36:58 EDT 2001


"Emile van Sebille" <emile at fenx.com> wrote in message
news:9elsfg$2jc1$1 at ID-11957.news.dfncis.de...
    ...
> > > 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]]
> ans=[x*x+1for x in range(10)]

No fair Emile -- the spec in the subject DOES mention a
name-binding IS part of the requirement!  The fact that
you don't need a space in '1for' is very interesting, and
surely boosts Python in the esteem of all developers who
are keenly aware that a language's only reason for being
is minimizing keystrokes (why call the result 'ans' when
'_' would do just as well, btw?!) -- but the fact that
the requested name rebinding doesn't seem to be serving
any actual purpose is NOT one we're supposed to notice!


Alex






More information about the Python-list mailing list