Commits

Anonymous committed b581f8f

pyscopes: using utils.cacheit for Scope.get_scope()

Comments (0)

Files changed (1)

rope/base/pyscopes.py

         self.pycore = pycore
         self.pyobject = pyobject
         self.parent = parent_scope
-        self.scopes = None
 
     def get_names(self):
         """Return the names defined or imported in this scope"""
         """The same as ``key in self.get_names()``"""
         return key in self.get_names()
 
+    @utils.cacheit
     def get_scopes(self):
         """Return the subscopes of this scope
 
         The returned scopes should be sorted by the order they appear.
         """
-        if self.scopes is None:
-            self.scopes = self._create_scopes()
-        return self.scopes
+        return self._create_scopes()
 
     def lookup(self, name):
         if name in self.get_names():