Hi,

couldn't resist to announce that this little optimisation is now in
cython-unstable. An example of a corresponding for-in loop is below.

Have fun,

Stefan

/* ...
 * def multi_c_enumerate():
 *     cdef int a,b,c,d
 *     for a,(b,(c,d)) in enumerate(enumerate(enumerate(range(1,5)))):
        # <<<<<<<<<<<<<<
 *         print a,b,c,d
 */
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  for (__pyx_t_4 = 1; __pyx_t_4 < 5; __pyx_t_4+=1) {
    __pyx_v_d = __pyx_t_4;
    __pyx_v_c = __pyx_t_3;
    __pyx_t_3 = (__pyx_t_3 + 1);
    __pyx_v_b = __pyx_t_2;
    __pyx_t_2 = (__pyx_t_2 + 1);
    __pyx_v_a = __pyx_t_1;
    __pyx_t_1 = (__pyx_t_1 + 1);

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

Reply via email to