Carl Witty wrote: > On Wed, Jan 28, 2009 at 2:10 PM, Dag Sverre Seljebotn > <[email protected]> wrote: > >> 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) >> > > So if I understand correctly, the optimized range would act > differently than an unoptimized range would? That seems like a bad > idea, especially since the range optimization is on by default. > Hmm.. yes, range(-i, i) would be an empty list when i is unsigned...
OK I suppose I give up :-) Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
