Hi Andreas, that hasn't been a QGIS decision but a python3 one.
next(featureIterator) is the way proposed for python3. I am not sure about the reasons for this change though. Matthias On 09/15/2017 03:40 PM, Andreas Neumann wrote: > Hi, > > Found out that I can access my first feature like: > > feature = list(FeatureIterator)[0] > > but not sure if this is recommended and efficient. > > Why was the next() method of the feature iterator removed in QGIS 3? Is > there a particular reason for that? > > Thanks, > > Andreas > > > On 15.09.2017 14:43, Andreas Neumann wrote: >> Hi, >> >> While porting a project from QGIS 2x to 3x I came across a Python issue: >> >> In QGIS 2.x I had a code like below working: >> >> feature = FeatureIterator.next() >> >> In QGIS 3x it says that object has no attribut next. >> >> How do I access the first result of a feature iterator in QGIS 3? >> >> I don't want to loop, because I know that my FeatureIterator always >> has just one result. I just want to access this first feature. >> >> Thanks for your help, >> >> Andreas >> >> _______________________________________________ >> QGIS-Developer mailing list >> QGIS-Developer@lists.osgeo.org >> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer >> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer > > _______________________________________________ > QGIS-Developer mailing list > QGIS-Developer@lists.osgeo.org > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer > _______________________________________________ QGIS-Developer mailing list QGIS-Developer@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer