Hacker News new | ask | show | jobs
by harlowja 3773 days 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'}}
1 comments

This is exactly what copy.deepcopy() is for. Although if you're headed down this road, you're generally in for a bad time.