summaryrefslogtreecommitdiffstats
path: root/Lib/lib2to3/pytree.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/lib2to3/pytree.py')
-rw-r--r--Lib/lib2to3/pytree.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/Lib/lib2to3/pytree.py b/Lib/lib2to3/pytree.py
index 15b83f6..c502771 100644
--- a/Lib/lib2to3/pytree.py
+++ b/Lib/lib2to3/pytree.py
@@ -289,8 +289,7 @@ class Node(Base):
for node in child.post_order():
yield node
- @property
- def prefix(self):
+ def _prefix_getter(self):
"""
The whitespace and comments preceding this node in the input.
"""
@@ -298,11 +297,12 @@ class Node(Base):
return ""
return self.children[0].prefix
- @prefix.setter
- def prefix(self, prefix):
+ def _prefix_setter(self, prefix):
if self.children:
self.children[0].prefix = prefix
+ prefix = property(_prefix_getter, _prefix_setter)
+
def set_child(self, i, child):
"""
Equivalent to 'node.children[i] = child'. This method also sets the
@@ -390,18 +390,17 @@ class Leaf(Base):
"""Return a pre-order iterator for the tree."""
yield self
- @property
- def prefix(self):
+ def _prefix_getter(self):
"""
The whitespace and comments preceding this token in the input.
"""
return self._prefix
- @prefix.setter
- def prefix(self, prefix):
+ def _prefix_setter(self, prefix):
self.changed()
self._prefix = prefix
+ prefix = property(_prefix_getter, _prefix_setter)
def convert(gr, raw_node):
"""