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)