Weird lambda behavior (bad for)

Aahz aahz at
Sun Apr 26 18:30:17 CEST 2009

In article <gt0d15$167c$1 at>,
namekuseijin  <namekuseijin.nospam at> wrote:
>I don't like *for* at all.  It both makes it tough to get true closures 
>and also unnecessarily pollutes the namespace with non-local variables.

Maybe.  Consider this standard Python idiom:

for x in L:
    if x == criterion:

Obviously, this case could be rewritten fairly easily to hoist
doSomething into the loop before the break, but I've seen other cases
less amenable.
Aahz (aahz at           <*>

"If you think it's expensive to hire a professional to do the job, wait
until you hire an amateur."  --Red Adair

More information about the Python-list mailing list