empiricaldist icon indicating copy to clipboard operation
empiricaldist copied to clipboard

Make Pmf.copy() create deep copies by default

Open gaborcs opened this issue 1 year ago • 0 comments

Pmf.copy() was recently changed to create shallow copies by default: https://github.com/AllenDowney/empiricaldist/commit/e1c6cc9a903b613fa5e388719a73ae6968f25ac0

I suspect that change was unintentional, since creating a deep copy is a safer default, and it's what I would expect based on the method name. Also, all other classes in this library have a copy method that creates a deep copy by default.

Changing this back to creating deep copies will fix some code snippets in the Think Bayes book, and probably elsewhere too. I believe it is unlikely to break anything, since creating a deep copy is almost always what users of this method intend to do.

gaborcs avatar Nov 26 '23 11:11 gaborcs