[Cython] Fix for #196 (for loop bug)
Dag Sverre Seljebotn
dagss at student.matnat.uio.no
Fri Jan 30 12:56:00 CET 2009
Magnus Lie Hetland wrote:
> Hi!
>
> I've put together a tiny patch for the for loop bug, and just thought
> I'd run it by you guys. As far as I understand, the "for ... from"
> node is also used for optimized range()-loops (i.e., over C integer
> indices) -- so that's the only place I fixed anything. (It seems to
> work for range too, now.)
>
I continously come to think about more stuff here :-)
I think we should leave the semantics of the for-from statement alone at
the moment, since it was introduced to mimick the C construct (and for
all I know code may depend on the C behaviour here).
The solution would be to have a flag in the ForFromStatNode, which you
could turn on when the node is the result of a transform from a
for-in-range. Which is done in Optimize.py line 140.
Dag Sverre
More information about the Cython-dev
mailing list