Hi Bob,

> "list comprehension" (once understood) is often easier to read and more 
> efficient than the for loop.

They are often more efficient but I don't know if I'd ever claim they were 
easier to read than an explicit for loop. Perhaps the most trivial cases
like 

z = [x*2 for x in L] 

and even then I'm not sure that is easier to read than 

z = []
for x in L: z.append(x*2)

And personally I still find map() easier for those cases

z = map(lambda x: x*2, L)

But you do need to be comfortable with lambda for that, and lambda 
is just as hard to grok as list comprehensions! :-)

Alan G.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to