This executes without error:
def myfunction():
global a_dict
a_dict['s'] = 'whatevs'
b_dict['s'] = 'lalala'
a_dict = b_dict
a_dict = {'s':[], 'm':[]}
b_dict = {'s':[], 'm':[]}
myfunction()
Why does this not throw an error without also adding global b_dict
to the function - as I'm writing to both dictionaries?
It sure does if I comment out the global a_dict
("'a_dict' referenced before assignment") - as I would expect.