43
44 def generic_visit(self, node: Node, *args: t.Any, **kwargs: t.Any) -> t.Any:
45 """Called if no explicit visitor function exists for a node."""
46 for node in node.iter_child_nodes():47 self.visit(node, *args, **kwargs)
48
49
A local name is redefining an argument, which might suggest a potential error. This is taken into account only for a handful of name binding operations, such as for
iterations, with
statements, and exception handler assignments.
def print_files(filename):
with open(filename) as f:
files = f.readlines()
for filename in files: # `filename` is already defined outside!
print(filename)
def print_files(filename):
with open(filename) as f:
files = f.readlines()
for file in files: # renamed it to `file` to avoid conflict
print(file)