def node_is_child_of_parent_expr(parent, child):
for cursor_node in ast.iter_child_nodes(parent):
if cursor_node == child or (isinstance(cursor_node, ast.expr) and node_is_child_of_parent_expr(cursor_node, child)):
return True
return False
评论列表
文章目录