Prajwal Suhas P wrote:
> I changed the code to
> 
> cdef int g():
>     print "g called"
>     return 3
> 
> def f():
>     for i in range(g()):
>         print i
>     print i
> 
> we get the right output here
> 
> g called
> 0
> 1
> 2
> 2
> 
> the c output changes(and is wrong) when we declare a "cdef int i" before 
> the for loop.i missed this part initially.

Yes, when "i" is not typed as int, the Python "range" function is 
called, which gives the right behaviour. The task is to make Cython do 
the right thing when i is declared "cdef int" as well.


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

Reply via email to