[GRASS-SVN] r62134 - grass/trunk/lib/python/pygrass/vector
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Sep 30 01:46:23 PDT 2014
Author: zarch
Date: 2014-09-30 01:46:23 -0700 (Tue, 30 Sep 2014)
New Revision: 62134
Modified:
grass/trunk/lib/python/pygrass/vector/__init__.py
Log:
pygrass: Fix how slice are handled (contribution: Maurizio Cingi)
Modified: grass/trunk/lib/python/pygrass/vector/__init__.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/__init__.py 2014-09-30 08:45:07 UTC (rev 62133)
+++ grass/trunk/lib/python/pygrass/vector/__init__.py 2014-09-30 08:46:23 UTC (rev 62134)
@@ -273,10 +273,10 @@
..
"""
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:
More information about the grass-commit
mailing list