[Python-ideas] A conditional "for" statement
Greg Ewing
greg.ewing at canterbury.ac.nz
Fri Apr 24 02:20:40 CEST 2009
Michael S. Gilbert wrote:
> What about the difference in efficiency? For the second case, you've
> reduced the number of iterations (by the number of items that your
> conditional expression has excluded) and eliminated one operation per
> iteration (evaluation the if statement).
No, you haven't. You still have to perform the test
for every iteration. Your proposed syntax would do
*exactly* the same thing as the 3-line version.
--
Greg
More information about the Python-ideas
mailing list