On Mar 23, 2009, at 1:31 AM, Stefan Behnel wrote: > Dag Sverre Seljebotn wrote: >> Once "i" is put in a temporary as well (so that modifying "i" >> within the >> loop doesn't affect looping) this should not be necesarry as the >> startpoint will only be called once. > > ... and the assignment to "i" will happen inside the loop, so that > loops > that never run do not touch the value of "i". That's prefect Python > behaviour. > > >> (Then one would go back to the old behaviour with for-from I suppose, >> i.e. so that "for i from 10 <= i < 7: pass" would assign 10 to i). > > Hmmm, did we change that? I can't remember discussing this bit. > > Looks like we really need a Wiki page here that clearly specifies the > semantics of both loops in all corner cases...
http://wiki.cython.org/loops , according to how I think of them. >> BTW one should ideally test with negative steps as well, though I >> expect >> the result to be the same. I.e. "for i in range(10, somefunc(), >> -1)" and >> so on. > > Yes, that's missing from the test cases, but it's an important point. > > Stefan > > _______________________________________________ > Cython-dev mailing list > [email protected] > http://codespeak.net/mailman/listinfo/cython-dev _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
