Robert Bradshaw wrote: > There's a lot of work going on with loops right now, I've also > discovered http://trac.cython.org/cython_trac/ticket/243 . Another > problem is that we haven't nailed down exactly what the semantics for > the for...from loop should be. Should it be a C loop (where the > endpoint and step are re-evaluated every time, and changing the index > variable from the loop body modifies the loop behavior) or simply > alternative syntax for the for...in range() loop. I would say the > latter, (use a while loop if one wants the other behavior) but > certainly not some hybrid like we have now.
At least changing the value the iterator variable has after the loop "from C to Python semantics" (to use a phrase that's awfully familiar) would potentially break code. And then the semantics differ between the two anyway. I think a case could be made that "for-from is the C for loop", and always reevaluate end/step. However, myself I consider for-from present mostly for backwards compatability anyway, and so I don't really have an opinion about "the right" behaviour here. -- Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
