I recently got bitten by this:

cdef int i
cdef unsigned n = 3
for i in range(-n, n):
     ...

Here, the loop will never be run.

I first submitted http://trac.cython.org/cython_trac/ticket/184 which 
was invalid, but I have another proposal:

Can we let the type of the parameters to the magic, optimize range 
function be determined by the type of the iterator?

So, in the example above, range would be prototyped roughly

cdef int range(int, int)

while if "i" had been typed as unsigned, range would behave as

cdef int range(unsigned, unsigned)


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

Reply via email to