Does it make any difference, if the start point in a range() is a function call or even if it is modified to a new value inside the loop?  Even if it is modified, the start would be evaluated only once, isn&#39;t it?  I defined a start function and supplied it to the range() and from the output it looked like start is called once, and also the c output seems to agree with this.   In this case if the start is a function call, then it doesn&#39;t have to be handled right?  I am not sure if I have caught the topic right!  Or am i missing something here?<br>
<br><br><div class="gmail_quote">On Wed, Mar 18, 2009 at 3:33 AM, Robert Bradshaw <span dir="ltr">&lt;<a href="mailto:robertwb@math.washington.edu">robertwb@math.washington.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On Mar 17, 2009, at 2:35 PM, Greg Ewing wrote:<br>
<br>
&gt; Dag Sverre Seljebotn wrote:<br>
&gt;<br>
&gt;&gt; ForFromStatNode is used in two situations in Cython code; in the<br>
&gt;&gt; Cython-specific syntax<br>
&gt;&gt;<br>
&gt;&gt; cdef int i<br>
&gt;&gt; for i from start &lt;= i &lt; end [by step]:<br>
&gt;&gt;     ...<br>
&gt;&gt;<br>
&gt;&gt; In the former case, end should NOT be frozen (i.e. if it is a<br>
&gt;&gt; function<br>
&gt;&gt; call it should be called again for every iteration<br>
&gt;<br>
&gt; Has Cython changed this? It&#39;s not how the for-from<br>
&gt; statement works in Pyrex -- the limits are only<br>
&gt; evaluated once.<br>
<br>
</div>No, Cython has not changed this, and I&#39;m not sure we should. But<br>
there is some inconsistency:<br>
<br>
%cython<br>
cdef int get_bound(int m):<br>
     print &quot;get_bound(%s)&quot;%m<br>
     return m<br>
<br>
def test_var(int n, int m):<br>
     cdef int i<br>
     for i from 0 &lt;= i &lt; n:<br>
         print &quot;at&quot;, i<br>
         n = m<br>
     return i<br>
<br>
def test_func(int n):<br>
     cdef int i<br>
     for i from 0 &lt;= i &lt; get_bound(n):<br>
         print &quot;at&quot;, i<br>
     return i<br>
<br>
sage: test_var(10, 5)<br>
at 0<br>
at 1<br>
at 2<br>
at 3<br>
at 4<br>
5<br>
sage: test_func(5)<br>
get_bound(5)<br>
at 0<br>
at 1<br>
at 2<br>
at 3<br>
at 4<br>
5<br>
<font color="#888888"><br>
- Robert<br>
</font><div><div></div><div class="h5"><br>
_______________________________________________<br>
Cython-dev mailing list<br>
<a href="mailto:Cython-dev@codespeak.net">Cython-dev@codespeak.net</a><br>
<a href="http://codespeak.net/mailman/listinfo/cython-dev" target="_blank">http://codespeak.net/mailman/listinfo/cython-dev</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Regards,<br>Anoop S.<br><br>People who says, &quot;It&#39;s not winning or losing that matters, but participation&quot;, probably lost.<br>