-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
Closed as not planned
Closed as not planned
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
Proposal:
class FindNames(ast.NodeVisitor):
def visit_Name(self, node):
return node.id
tree = ast.parse(src_code)
names = FindNames().visit(tree) # will return None for the tree, should return list of all names.
Currently ast.NodeVisitor iterates through all the nodes in tree calls the defined visit_
methods but returns None.
Proposal:
NodeVisitor's generic_visit should not return None when it has visited all the nodes, It will be more appropriate for it to return List of all return values of visit_
calls.
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement