1# ticket: t254 2 3def double_target(a, b): 4 """ 5 >>> double_target(0, 4) 6 at 0.0 7 at 1.0 8 at 2.0 9 at 3.0 10 4.0 11 """ 12 cdef double x 13 for x from a <= x < b: 14 print u"at", x 15 return x 16 17def double_step(a, b, dx): 18 """ 19 >>> double_step(0, 2, .5) 20 at 0.0 21 at 0.5 22 at 1.0 23 at 1.5 24 2.0 25 """ 26 cdef double x 27 for x from a <= x < b by dx: 28 print u"at", x 29 return x 30 31def double_step_typed(a, b, double dx): 32 """ 33 >>> double_step_typed(0, 2, .5) 34 at 0.0 35 at 0.5 36 at 1.0 37 at 1.5 38 2.0 39 """ 40 cdef double x 41 for x from a <= x < b by dx: 42 print u"at", x 43 return x 44 45def double_step_py_target(a, b, double dx): 46 """ 47 >>> double_step_py_target(0, 2, .5) 48 at 0.0 49 at 0.5 50 at 1.0 51 at 1.5 52 2.0 53 """ 54 cdef object x 55 for x from a <= x < b by dx: 56 print u"at", x 57 return x 58 59def int_step_py_target(a, b, int dx): 60 """ 61 >>> int_step_py_target(0, 2, 1) 62 at 0 63 at 1 64 2 65 """ 66 cdef object x 67 for x from a <= x < b by dx: 68 print u"at", x 69 return x 70