Cassiopeia icon indicating copy to clipboard operation
Cassiopeia copied to clipboard

Implement custom copy & deepcopy methods in CassiopeiaTree

Open mattjones315 opened this issue 3 years ago • 0 comments

Currently we are invoking copy.deepcopy(self) when trying to copy a CassiopeiaTree. It would be better to implement a custom version of both copy and deepcopy for users. See https://docs.python.org/3/library/copy.html , specifically:

In order for a class to define its own copy implementation, it can define special methods copy() and deepcopy(). The former is called to implement the shallow copy operation; no additional arguments are passed. The latter is called to implement the deep copy operation; it is passed one argument, the memo dictionary. If the deepcopy() implementation needs to make a deep copy of a component, it should call the deepcopy() function with the component as first argument and the memo dictionary as second argument.

mattjones315 avatar Aug 05 '21 22:08 mattjones315