[Cython] can we deprecate for-from loops?

Kevin Norris nykevin.norris at gmail.com
Sun Oct 11 22:57:29 EDT 2015


Greg Ewing wrote:
> Stefan Behnel wrote:
> > Hi!
> >
> > The syntax construct "for i from 0 <= i < 10" has been silently outdated
> > for years. Can we start issuing a warning that normal range() loops are
> > preferred?
>
> I'd be in favour of replacing it with just 'for 0 <= i < 10',
> but -1 on removing it altogether.
>
> I introduced it in Pyrex for a reason -- to clearly express
> iterations over ranges of integers with arbitrary combinations
> of open/closed endpoints, for use in conjunction with C code.
> I believe that reason is still valid.
>
> --
> Greg

IMHO, either it should be un-deprecated in the documentation[1], or
the compiler should start issuing warnings and eventually errors.  You
can't have it both ways.  Either it's deprecated or it isn't.

[1]: http://docs.cython.org/src/reference/language_basics.html#for-loops

--
Kevin


More information about the cython-devel mailing list