the.bay.news

Explicit post-order hooks for ast.NodeTransformer

Discussions on Python.org
Explicit post-order hooks for ast.NodeTransformer
This is a proposal for the ast module in the standard library, to include a BidirectionalTransformer that extends NodeTransformer with leave_* dispatch after normal visit_* processing. class BidirectionalTransformer(ast.NodeTransformer): def visit(self, node: ast.AST) -> Any: node = super().visit(node) if isinstance(node, ast.AST): return self._leave(node) if isinstance(node, list): # If visit_* returns a list, then leave_* is called on each...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.