On Jan 30, 2009, at 14:03, Magnus Lie Hetland wrote:

>   for i in range(0,10,2): pass
>   for j in range(0,10,getstep()): pass
>
>   print i, j
>   # (10, 8)


Ahm. I guess the explanation here was, in fact, quite obvious from the  
fact that the code was too hairy for me to see the bug: Unless I'm  
mistaken, the version with the function call isn't optimized and  
hence, its behavior is in line with Python semantics.

Then again, if getstep is cdef-ed to return an int, why *isn't* this  
optimized to a for-from-loop? (And if it should be, the local variable  
issue that Dag Sverre mentioned is again relevant.)

-- 
Magnus Lie Hetland
http://hetland.org


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

Reply via email to