summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Fedoseev <fedoseev.sergey@gmail.com>2017-04-05 18:37:04 +0500
committerTim Graham <timograham@gmail.com>2017-04-11 12:46:41 -0400
commita296a433094a4c287f601b8cae875648ed9c91dc (patch)
tree7057c374378d44e13d8fec61f131e4c0a9955e60
parentd453dfb1daea58e441fee0bb36b57d8b200f785c (diff)
Refs #28024 -- Optimized GEOSCoordSeq.__getitem__() by avoiding superfluous index and dimension checks.
-rw-r--r--django/contrib/gis/geos/coordseq.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/django/contrib/gis/geos/coordseq.py b/django/contrib/gis/geos/coordseq.py
index 1a97e71f72..37c6816771 100644
--- a/django/contrib/gis/geos/coordseq.py
+++ b/django/contrib/gis/geos/coordseq.py
@@ -39,10 +39,8 @@ class GEOSCoordSeq(GEOSBase):
def __getitem__(self, index):
"Return the coordinate sequence value at the given index."
- coords = [self.getX(index), self.getY(index)]
- if self.dims == 3 and self._z:
- coords.append(self.getZ(index))
- return tuple(coords)
+ self._checkindex(index)
+ return self._point_getter(index)
def __setitem__(self, index, value):
"Set the coordinate sequence value at the given index."