ast.copy_location()
ast.copy_location() is a Python function in the AST Module category. Copies source location information from old_node to new_node. The syntax is ast.copy_location(new_node, old_node). Returns: Updated AST node. A typical example: ast.copy_location(new_expr, old_expr). A close sibling is ast.literal_eval(), which safely evaluates a string containing a Python literal (list, dict, tuple, number, string, bool, None). A close sibling is ast.parse(), which parses Python source code into an AST (Abstract Syntax Tree). A close sibling is ast.dump(), which returns a formatted string representation of an AST node. A close sibling is ast.walk(), which recursively yields all descendant AST nodes (depth-first). More about this category: Abstract Syntax Tree — literal_eval, parse, dump, walk. Related AST Module entries: ast.literal_eval(), ast.parse(), ast.dump(), ast.walk(), ast.get_source_segment(), ast.fix_missing_locations(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details.