summaryrefslogtreecommitdiff
path: root/Lib/lib2to3/pytree.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/lib2to3/pytree.py')
-rw-r--r--Lib/lib2to3/pytree.py19
1 files changed, 3 insertions, 16 deletions
diff --git a/Lib/lib2to3/pytree.py b/Lib/lib2to3/pytree.py
index 17cbf0a2f9..ad3592c05f 100644
--- a/Lib/lib2to3/pytree.py
+++ b/Lib/lib2to3/pytree.py
@@ -64,16 +64,6 @@ class Base(object):
__hash__ = None # For Py3 compatibility.
- def __ne__(self, other):
- """
- Compare two nodes for inequality.
-
- This calls the method _eq().
- """
- if self.__class__ is not other.__class__:
- return NotImplemented
- return not self._eq(other)
-
def _eq(self, other):
"""
Compare two nodes for equality.
@@ -194,8 +184,7 @@ class Base(object):
def leaves(self):
for child in self.children:
- for x in child.leaves():
- yield x
+ yield from child.leaves()
def depth(self):
if self.parent is None:
@@ -274,16 +263,14 @@ class Node(Base):
def post_order(self):
"""Return a post-order iterator for the tree."""
for child in self.children:
- for node in child.post_order():
- yield node
+ yield from child.post_order()
yield self
def pre_order(self):
"""Return a pre-order iterator for the tree."""
yield self
for child in self.children:
- for node in child.pre_order():
- yield node
+ yield from child.pre_order()
def _prefix_getter(self):
"""