I'm confused about the behaviour of dictionaries with global function. In the following examples, why does the first case print {'abc':123} but the second {'abc': 456}? I am using python 2.7.
first example:
def foo():
test_dict = {}
bar()
def bar():
test_dict['abc'] = 123
test_dict = {'abc':456}
foo()
print test_dict
second example:
test_dict = {'abc':456}
def foo():
test_dict = {}
test_dict['abc'] = 123
foo()
print test_dict