Thanks Matthias for explaining about that. Good to know.

Andreas


On 15.09.2017 16:22, Matthias Kuhn wrote:
Hi Andreas,

that will be done automatically when the iterator scopes out or the last
feature is yielded.
There is normally no reason to care about this method.

Matthias

On 09/15/2017 04:04 PM, Andreas Neumann wrote:
Just a quick followup question.

I see that the QgsFeatureIterator has a close method.

Should Python authors care about closing an existing feature iterator or
would this be automatically done when the script stops executing?

Andreas


On 15.09.2017 15:48, Andreas Neumann 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


so instead of:

it = layer.getFeatures()
it.next()

just type

it = layer.getFeatures()
next(it)

Matteo
_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to