Bruno Desthuilliers schreef: > stdazi a écrit : >> for (i = 0 ; i < 10 ; i++) >> i = 10; > > for i in range(10): > i = 10 > > What's your point, exactly ?
In the first iteration, i is set equal to 10. Then, before starting the second iteration, i is incremented to 11; then the loop condition is checked and results in false. So the loop terminates after the first iteration. So, the point is that in C you can influence the loop's behavior by modifying the loop variable, while you cannot do that in Python (at least not in a for-loop). In other words, the point is that you can't translate loops literally from C to Python. Which is nothing new, and I fail to see how that is supposed to be a disadvantage. -- If I have been able to see further, it was only because I stood on the shoulders of giants. -- Isaac Newton Roel Schroeven -- http://mail.python.org/mailman/listinfo/python-list