On May 10, 2008, at 3:03 PM, Lisandro Dalcin wrote:
> On 5/10/08, Stefan Behnel <[EMAIL PROTECTED]> wrote:
>>  I don't quite see why we shouldn't just always convert
>>
>>     for var in range(begin, end):
>>
>>  to
>>
>>     for var in begin <= var < end:
>>
>>
>> *iff* var is cdef-ed as a C integer type.
>
> I'm definitely +1 on this!!

This is actually enabled in the current version of Cython: http:// 
hg.cython.org/cython/file/0927890724ab/Cython/Compiler/Options.py

> Regarding to the overflow issue, perhaps
> a check can be added before entering the loop.

This is the semantic difference--if there will be an overflow then  
Cython throws an error before entering the loop (rather than looping  
until an overflow would occur). I think this is acceptable.

> And Cython should take
> care if the user modifies the range() arguments inside de loop. What
> will you do in this case? IMHO,  matching the Python semantics is the
> right way.

One can't do that (in Python or Cython) as range() is evaluated  
exactly once, before entering the loop, so this is a non-issue.

- Robert

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to