Hi Dag,
I am currently looking at the tickets.
I was looking at this -
cdef int i, n
n = 10
for i in range(n):
if i == 5:
n *= 2
print i
The generated c code for this is -
__pyx_v_5test1_n = 10;
for (__pyx_v_5test1_i = 0; __pyx_v_5test1_i < __pyx_v_5test1_n;
__pyx_v_5test1_i+=1) {
__pyx_1 = (__pyx_v_5test1_i == 5);
if (__pyx_1) {
__pyx_v_5test1_n *= 2;
goto __pyx_L4;
}
__pyx_L4:;
}
Can the var 'n' be held in another temp variable?
Something like this -
__pyx_v_5test1_n = 10;
__pyx_v_5test1_const_n = 10;
for (__pyx_v_5test1_i = 0; __pyx_v_5test1_i < __pyx_v_5test1_const_n;
__pyx_v_5test1_i+=1) {
__pyx_1 = (__pyx_v_5test1_i == 5);
if (__pyx_1) {
__pyx_v_5test1_n *= 2;
goto __pyx_L4;
}
__pyx_L4:;
}
i--;
I haven't looked at the cython code which parses the loop and outputs the c
code. I would really appreciate if you can give me a head start into this
and correct me if I am wrong.
On Wed, Mar 11, 2009 at 2:57 PM, Dag Sverre Seljebotn <
[email protected]> wrote:
> Since there's been some interest in how to get started coding on Cython
> on the mailing list lately, I thought I'd call attention to these two
> tickets:
>
> http://trac.cython.org/cython_trac/ticket/158
> http://trac.cython.org/cython_trac/ticket/203
>
> These seems to fit the sweet spot of not being too hard to fix for
> beginners (with some mentoring), but not being completely trivial either.
>
> I'm happy to provide an attack strategy/small amount of mentoring for
> these tickets if anybody's interested.
>
> --
> Dag Sverre
> _______________________________________________
> Cython-dev mailing list
> [email protected]
> http://codespeak.net/mailman/listinfo/cython-dev
>
--
Regards,
Prajwal S.
"There is little difference in people,but this little difference makes a big
difference.The little difference is attitude,the big difference is whether
its positive or negative. "
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev