3 ms·
U may also want to mention that #5 is pretty much violated in all of these if say a nested dict (or really any other object that is by reference) is in default
by harlowja 11y ago
U may also want to mention that #5 is pretty much violated in all of these if say a nested dict (or really any other object that is by reference) is in default or user.
>>> x = {'a': {}}
>>> y = x.copy()
>>> y['a']['b'] = 'c'
>>> x
{'a': {'b': 'c'}}
- Brainix 11y agoThis is exactly what copy.deepcopy() is for. Although if you're headed down this road, you're generally in for a bad time.