]> granicus.if.org Git - python/commitdiff
Add getChildNodes() method to Node
authorJeremy Hylton <jeremy@alum.mit.edu>
Tue, 14 Aug 2001 18:58:00 +0000 (18:58 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Tue, 14 Aug 2001 18:58:00 +0000 (18:58 +0000)
Tools/compiler/astgen.py
Tools/compiler/compiler/astgen.py

index c31ca548bba1dd7c708c2f2d18f790bb0859d3b4..fc929936cdc14e16f8726e9986518e2b6fcef918 100644 (file)
@@ -171,6 +171,8 @@ class Node:
         return flatten(self._getChildren())
     def asList(self):
         return tuple(asList(self.getChildren()))
+    def getChildNodes(self):
+        return [n for n in self.getChildnre() if isinstance(n, Node)]
 
 class EmptyNode(Node):
     def __init__(self):
index c31ca548bba1dd7c708c2f2d18f790bb0859d3b4..fc929936cdc14e16f8726e9986518e2b6fcef918 100644 (file)
@@ -171,6 +171,8 @@ class Node:
         return flatten(self._getChildren())
     def asList(self):
         return tuple(asList(self.getChildren()))
+    def getChildNodes(self):
+        return [n for n in self.getChildnre() if isinstance(n, Node)]
 
 class EmptyNode(Node):
     def __init__(self):