[GRASS-SVN] r55952 - grass/trunk/lib/python/pygrass/vector
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Apr 23 03:45:23 PDT 2013
Author: zarch
Date: 2013-04-23 03:45:23 -0700 (Tue, 23 Apr 2013)
New Revision: 55952
Modified:
grass/trunk/lib/python/pygrass/vector/__init__.py
Log:
Update the docstring with the *with statement*.
Modified: grass/trunk/lib/python/pygrass/vector/__init__.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/__init__.py 2013-04-23 09:52:03 UTC (rev 55951)
+++ grass/trunk/lib/python/pygrass/vector/__init__.py 2013-04-23 10:45:23 UTC (rev 55952)
@@ -203,6 +203,21 @@
#=============================================
class VectorTopo(Vector):
+ """Vector class with the support of the GRASS topology.
+
+ Open a vector map using the *with statement*: ::
+
+ >>> with VectorTopo('schools') as schools:
+ ... for school in schools[:3]:
+ ... print school.attrs['NAMESHORT']
+ ...
+ SWIFT CREEK
+ BRIARCLIFF
+ FARMINGTON WOODS
+ >>> schools.is_open()
+ False
+
+ """
def __init__(self, name, mapset=''):
super(VectorTopo, self).__init__(name, mapset)
self._topo_level = 2
More information about the grass-commit
mailing list