diff options
-rw-r--r-- | Doc/library/ast.rst | 2 | ||||
-rw-r--r-- | Lib/ast.py | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst index 80afbbc..6ca2760 100644 --- a/Doc/library/ast.rst +++ b/Doc/library/ast.rst @@ -308,7 +308,7 @@ and classes for traversing abstract syntax trees: value=Name(id='data', ctx=Load()), slice=Index(value=Constant(value=node.id)), ctx=node.ctx - ), node) + ) Keep in mind that if the node you're operating on has child nodes you must either transform the child nodes yourself or call the :meth:`generic_visit` @@ -408,11 +408,11 @@ class NodeTransformer(NodeVisitor): class RewriteName(NodeTransformer): def visit_Name(self, node): - return copy_location(Subscript( + return Subscript( value=Name(id='data', ctx=Load()), slice=Index(value=Str(s=node.id)), ctx=node.ctx - ), node) + ) Keep in mind that if the node you're operating on has child nodes you must either transform the child nodes yourself or call the :meth:`generic_visit` |