From: Jeremy Hylton Date: Tue, 14 Aug 2001 18:58:00 +0000 (+0000) Subject: Add getChildNodes() method to Node X-Git-Tag: v2.2a3~564 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=eef65908a10f9fc7f2b69e826d324a4189e4d341;p=thirdparty%2FPython%2Fcpython.git Add getChildNodes() method to Node --- diff --git a/Tools/compiler/astgen.py b/Tools/compiler/astgen.py index c31ca548bba1..fc929936cdc1 100644 --- a/Tools/compiler/astgen.py +++ b/Tools/compiler/astgen.py @@ -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): diff --git a/Tools/compiler/compiler/astgen.py b/Tools/compiler/compiler/astgen.py index c31ca548bba1..fc929936cdc1 100644 --- a/Tools/compiler/compiler/astgen.py +++ b/Tools/compiler/compiler/astgen.py @@ -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):