"For" loop and list comprehension similarity

s.lipnevich at gmail.com s.lipnevich at gmail.com
Mon Mar 27 01:14:30 CEST 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