list1 = ["AAA", "BBB"]
for item in list1:
print(item)
print (item) # <--- out of scope, but Python doesn't report any error
For the code above, although item
is out of its scope, Python will not report an error.
Is it possible to force Python to report an error?