This code gives the error: UnboundLocalError: local variable 'LINES' referenced before assignment but LINES is clearly initialized since if I comment out the line below the print statement it throws no errors and prints len(lines) = 0 as expected. Am I not understanding something about python?? Whats going on here?
LINES = []
def foo():
for prob in range(1,3):
print "len(lines) = %d" % len(LINES)
LINES = []
if __name__ == "__main__":
foo()