polydojo/dotsi

Missing __deepcopy__ implementation

TobiSan5 opened this issue · 1 comments

When trying a copy.deepcopy() on a Dotsi instance, there were a KeyError on deepcopy. Passing dict-structures around can easily lead to errors, if one doesn't make a deepcopy of the object. Thus, Dotsi would be better if it had it implementet.

Hi @TobiSan5, thanks for creating this issue!

I agree with you. Deep-copying is useful, and __deepcopy__ should be added to DotsiDict. Will need to add the same to DotsiList too, as the two classes go hand-in-hand.

In the meantime, you could use the (currently undocumented) dotsi.deepCopy() function. It can deep-copy dict, DotsiDict, list, and DotsiList instances.