From 138a78ec8cab5e1df0c8ba2a3ee895cb756ff1ae Mon Sep 17 00:00:00 2001 From: Sergey Fedoseev Date: Wed, 12 Jul 2017 22:13:57 +0500 Subject: [PATCH] Made LineString.__iter__() return iter() from internal GEOSCoordSeq both for simplicity and performance. --- django/contrib/gis/geos/linestring.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/django/contrib/gis/geos/linestring.py b/django/contrib/gis/geos/linestring.py index eb339658e97..dd220d2bc3a 100644 --- a/django/contrib/gis/geos/linestring.py +++ b/django/contrib/gis/geos/linestring.py @@ -92,8 +92,7 @@ class LineString(LinearGeometryMixin, GEOSGeometry): def __iter__(self): "Allow iteration over this LineString." - for i in range(len(self)): - yield self[i] + return iter(self._cs) def __len__(self): "Return the number of points in this LineString."