Jelajahi Sumber

pygrass: Fix how slice are handled (contribution: Maurizio Cingi)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@62134 15284696-431f-4ddb-bdfa-cd5b030d7da7
Pietro Zambelli 10 tahun lalu
induk
melakukan
40e31815d3
1 mengubah file dengan 4 tambahan dan 4 penghapusan
  1. 4 4
      lib/python/pygrass/vector/__init__.py

+ 4 - 4
lib/python/pygrass/vector/__init__.py

@@ -273,10 +273,10 @@ class VectorTopo(Vector):
         ..
         """
         if isinstance(key, slice):
-            #import pdb; pdb.set_trace()
-            #Get the start, stop, and step from the slice
-            return [self.read(indx + 1)
-                    for indx in range(*key.indices(len(self)))]
+            return [self.read(indx)
+                    for indx in range(key.start if key.start else 1,
+                                      key.stop if key.stop else len(self),
+                                      key.step if key.step else 1)]
         elif isinstance(key, int):
             return self.read(key)
         else: