# File: global07.py # # b is considered defined in test() # even if it is "obvious" that the # assignment can never happen. # # Again, scope is lexical, binding is dynamic. # def test() : print("b = ", b) if 1 > 3: b = 1 return b = 303 test() print("b = ", b) ''' Output from the program: Traceback (most recent call last): File "global07.py", line 18, in test() File "global07.py", line 12, in test print("b = ", b) UnboundLocalError: local variable 'b' referenced before assignment '''