Peter Hansen wrote: > (I say "readable or somehow better" since you stated in another post "I > just try to use list/generator expression when possible" but you didn't > explain your reason for doing so. I assume you have some reason other > than arbitrary whim.) The reason is simple:
I found it easier to read for me and using list/generator expression helped me uncover a number of subtle bugs comparing with an imperative approach. on its own : takewhile(lambda x: condition(x), some_generator) is not very much difference than(well, still more things to type) (x for x in some_generator when condition(x)) but when I have a number of them in the same expression, the takewhile/dropwhile becomes to add up. -- http://mail.python.org/mailman/listinfo/python-list