[QGIS-Developer] FeatureIterator Python question

Matthias Kuhn matthias at opengis.ch
Fri Sep 15 07:21:37 PDT 2017


I was also thinking about that.
I would just miss this method because it's used so often and the
alternative approaches just require more typing.

+1 for this

On 09/15/2017 03:53 PM, Nathan Woodrow wrote:
> I think we could just implement out own next method to avoid that break
> would be easy enough.
> 
> On Fri, Sep 15, 2017 at 11:48 PM, Andreas Neumann <a.neumann at carto.net
> <mailto:a.neumann at carto.net>> wrote:
> 
>     Hi Matteo and Matthias,
> 
>     Thanks - that works fine. I did not know that this changed in Python 3.
> 
>     All the poor QGIS book authors who need to rewrite their books ...
>     about this Python changes.
> 
>     Helps a lot!
> 
>     Andreas
> 
> 
> 
> 
>     On 15.09.2017 15:44, matteo wrote:
> 
>         Hi Andreas,
> 
>         if I'm not wrong the next method is not been removed, it is a
>         python 3 *fix*
> 
>         https://stackoverflow.com/questions/1073396/is-generator-next-visible-in-python-3-0
>         <https://stackoverflow.com/questions/1073396/is-generator-next-visible-in-python-3-0>
> 
>         so instead of:
> 
>         it = layer.getFeatures()
>         it.next()
> 
>         just type
> 
>         it = layer.getFeatures()
>         next(it)
> 
>         Matteo
>         _______________________________________________
>         QGIS-Developer mailing list
>         QGIS-Developer at lists.osgeo.org
>         <mailto:QGIS-Developer at lists.osgeo.org>
>         List info:
>         https://lists.osgeo.org/mailman/listinfo/qgis-developer
>         <https://lists.osgeo.org/mailman/listinfo/qgis-developer>
>         Unsubscribe:
>         https://lists.osgeo.org/mailman/listinfo/qgis-developer
>         <https://lists.osgeo.org/mailman/listinfo/qgis-developer>
> 
> 
>     _______________________________________________
>     QGIS-Developer mailing list
>     QGIS-Developer at lists.osgeo.org <mailto:QGIS-Developer at lists.osgeo.org>
>     List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>     <https://lists.osgeo.org/mailman/listinfo/qgis-developer>
>     Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>     <https://lists.osgeo.org/mailman/listinfo/qgis-developer>
> 
> 
> 
> 
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> 


More information about the QGIS-Developer mailing list