Jan-13-2019, 02:10 AM
I have no idea, but I want to guess it would not.
>>> x = {"a": [1, 2, 3]} >>> y = {} >>> y.update(x) >>> x {'a': [1, 2, 3]} >>> y {'a': [1, 2, 3]} >>> x["a"].append(4) >>> x["b"] = 2 >>> x {'a': [1, 2, 3, 4], 'b': 2} >>> y {'a': [1, 2, 3, 4]} >>> y["a"].append(5) >>> x {'a': [1, 2, 3, 4, 5], 'b': 2} >>> y {'a': [1, 2, 3, 4, 5]}So it makes a shallow copy, but mutable objects (like lists) aren't copied, they're shared.