"For" loop and list comprehension similarity

s.lipnevich at gmail.com s.lipnevich at gmail.com
Sun Mar 26 18:14:30 EST 2006


> Why not combine the two:

I guess because (at least in source code) you're doing a loop twice
:-). I don't know what a compiler would do. I think though that the
"for i in c if test:" construct is more readable and maybe can even be
better optimized.
Thanks!

Sergey.




More information about the Python-list mailing list