I understand that when you make a shallow copy of the dictionary, you actually make a copy of the links. Therefore, if I do this:
x={'key':['a','b','c']} y=x.copy()
Thus, the link to the list ['a', 'b', 'c'] is copied to y. Whenever I change the list (for example, x['key'].remove('a') ), both dict x and y change. I understand this part. But when I consider a situation like the one below:
x={'user':'admin','key':['a','b','c']} y=x.copy()
When I do y['user']='guest' , x ['user'] will not change, but the list still has the same link. So my question is what makes a string different from a list? What is the mechanism of this?
jujae source share