On Sat, Mar 21, 2009 at 5:43 AM, Robert Bradshaw <
[email protected]> wrote:

> On Mar 20, 2009, at 12:18 AM, Stefan Behnel wrote:
>
> > Greg Ewing wrote:
> >> Robert Bradshaw wrote:
> >>
> >>> What about the behavior of
> >>>
> >>> for i from 0 <= i < 10:
> >>>      print i
> >>>      i += 5
> >>
> >> Undefined also.
> >
> > Saying "undefined" sounds a bit too simple here. Users will write
> > this kind
> > of code and intuitively expect it to work.
>
> I'd rather specify the behavior. How will people expect it to work?
> Currently, the loop will exit early if i is a cdef int, and not if
> it's a python object. Anyone have an opinion on this? (I'd be
> inclined to specify the former behavior just to preserve backwards
> compatibility.
>
> - Robert
>
> _______________________________________________
> Cython-dev mailing list
> [email protected]
> http://codespeak.net/mailman/listinfo/cython-dev
>

If I am not wrong a "for from" resolves to a pure c loop, because of which
I'd expect i to hold on to the modified value from inside the loop
irrespective of i being a python object or a cdef int type.  Can't we fall
back to the "cdef int i" kind of loop behaviour for both the cases?
Personally feel that it is more intuitive.

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

Reply via email to