<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: times new roman,new york,times,serif; font-size: 12pt; color: #000000'>No, it does False!<div><br></div><div>But if  I put <br>iterator.rewind()</div><div>before the first use of the iterator it does True.</div><div><br></div><div><br></div><div><br><hr id="zwchr"><div style="color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>Da: </b>"G. Allegri" <giohappy@gmail.com><br><b>A: </b>"Stefano Masera" <stefano.masera@arpa.piemonte.it><br><b>Cc: </b>"qgis-developer" <qgis-developer@lists.osgeo.org><br><b>Inviato: </b>Mercoledì, 23 ottobre 2013 16:36:12<br><b>Oggetto: </b>Re: [Qgis-developer] How can I reset the starting point of a QgsFeatureIterator?<br><br><div dir="ltr">Does <span style="font-family:'times new roman','new york',times,serif;font-size:16px">iterator.rewind() return True?</span></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/10/23 Stefano Masera <span dir="ltr"><<a href="mailto:stefano.masera@arpa.piemonte.it" target="_blank">stefano.masera@arpa.piemonte.it</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-size:12pt;font-family:times new roman,new york,times,serif"><span style="">Hi list,</span><div style="">
I use an iterator two times in a python code and I wantto reset it to the starting point before to reuse it.</div><div style="">In this way I hope to be more quick.</div><div style=""><br></div><div style=""># first use of the iterator</div>
<div style="">iterator = layer.dataProvider().getFeatures()   </div><div style=""></div><div style="">for feature in iterator:</div><div style=""><span style="white-space:pre-wrap">  </span>#  operations</div><div style=""></div><div style="">
# than, a second time I have to use the operator, in a following part of the code:</div><div style=""><div>for feature in iterator:</div><div><span style="white-space:pre-wrap">       </span>#  other operations</div></div><div style="">
<br></div><div style="">But it doesn't start from the first feature!</div><div style=""></div><div style=""><br></div><div style="">I try with:</div><div style="">iterator.rewind()</div><div style=""><span style="font-size:12pt">between the two blocks, </span>but it doesn't work.</div>
<div style=""><br></div><div style="">Thanks.</div><span class="HOEnZb"><font color="#888888"><div style=""></div><div style=""></div><div style=""></div><div style=""><br><div>Stefano Masera</div></div><br></font></span></div></div><br>_______________________________________________<br>

Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org" target="_blank">Qgis-developer@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Giovanni Allegri<br>
<a href="http://about.me/giovanniallegri" target="_blank">http://about.me/giovanniallegri</a><br>blog: <a href="http://blog.spaziogis.it" target="_blank">http://blog.spaziogis.it</a><br>GEO+ geomatica in Italia <a href="http://bit.ly/GEOplus" target="_blank">http://bit.ly/GEOplus</a>
</div>
</div><br></div></div></body></html>