<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt"><div class="" style=""><span class="" style="">Ciao,</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;" class=""><span class="" style=""><br class="" style=""></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;" class=""><span class="" style="">azzardo una risposta:</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;" class=""><span
 class="" style=""><br class="" style=""></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;" class=""><span class="" style="">credo che sia semplicemente per il fatto che layer.getfFeatures() restituisce un oggetto di tipo "iterator". Gli oggetti iterator si comportano in modo particolare, e all'interno di un ciclo for tutti gli elementi vengono elaborati in modo automatico. Credo che sia questo il motivo del comportamento che hai osservato.</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;" class=""><span class="" style=""><br class="" style=""></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica
 Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;" class=""><span class="" style="">Ti aggiungo un link che descrive gli iterator:</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;" class=""><span class="" style=""><br class="" style=""></span></div><div style="background-color: transparent;" class=""><span class="" style="">http://stackoverflow.com/questions/9884132/understanding-pythons-iterator-iterable-and-iteration-protocols-what-exact<br class="" style=""></span></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal;" class=""><span class="" style=""><br></span></div><div style="background-color:
 transparent; color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal;" class=""><span class="" style="">Matteo</span></div><div class="" style=""><br class="" style=""></div>  <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;" class=""> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;" class=""> <div dir="ltr" class="" style=""> <hr size="1" class="" style="">  <font size="2" face="Arial" class="" style=""> <b class="" style=""><span style="font-weight:bold;" class="">Da:</span></b> giulianc51 <giulianc51@gmail.com><br class="" style=""> <b class="" style=""><span style="font-weight: bold;" class="">A:</span></b> lista Gfoss <gfoss@lists.gfoss.it> <br class="" style=""> <b class="" style=""><span
 style="font-weight: bold;" class="">Inviato:</span></b> Venerdì 18 Aprile 2014 19:23<br class="" style=""> <b class="" style=""><span style="font-weight: bold;" class="">Oggetto:</span></b> [Gfoss] pyqgis: layer.getFeatures()<br class="" style=""> </font> </div> <div class="" style=""><br class="" style="">ciao a tutti,<br class="" style=""><br class="" style=""><br class="" style="">provo a porre quì un quesito che riguarda (py)qgis;<br class="" style=""><br class="" style="">volevo prevedere in un plugin, durante il trattamento di layer di<br class="" style="">dimensione importante, la stampa di un contatore per dare all'utente il<br class="" style="">senso dell'esecuzione in corso, a mò di progress bar; mi scontro però<br class="" style="">con un comportamento, per me inatteso, del comando in oggetto;<br class="" style=""><br class="" style="">mi aspettavo dall'esecuzione dei comandi (verificabile anche da console<br class="" style="">python):<br
 class="" style="">    i = 0<br class="" style="">    for f in layer.getFeatures():<br class="" style="">        i +=1<br class="" style="">        print i<br class="" style="">una visualizzazione progressiva (ho controllato di non aver posto una<br class="" style="">virgola in fondo al comando print); invece sembra che il ciclo FOR<br class="" style="">catturi il sistema e solo alla fine vi è la stampa quasi immediata di<br class="" style="">tutta la sequenza;<br class="" style=""><br class="" style="">sto sbagliando qualcosa senza accorgermene ?<br class="" style=""><br class="" style="">grazie, ciao,<br class="" style="">giuliano<br class="" style=""> <br class="" style="">_______________________________________________<br class="" style=""><a ymailto="mailto:Gfoss@lists.gfoss.it" href="mailto:Gfoss@lists.gfoss.it" class="" style="">Gfoss@lists.gfoss.it</a><br
 class="" style=""><a href="http://lists.gfoss.it/cgi-bin/mailman/listinfo/gfoss" target="_blank" class="" style="">http://lists.gfoss.it/cgi-bin/mailman/listinfo/gfoss</a><br class="" style="">Questa e' una lista di discussione pubblica aperta a tutti.<br class="" style="">I messaggi di questa lista non hanno relazione diretta con le posizioni dell'Associazione GFOSS.it.<br class="" style="">666 iscritti al 22.7.2013<br class="" style=""><br class="" style=""></div> </div> </div>  </div></body></html>