Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement custom copy & deepcopy methods in CassiopeiaTree #130

Open
mattjones315 opened this issue Aug 5, 2021 · 0 comments
Open

Implement custom copy & deepcopy methods in CassiopeiaTree #130

mattjones315 opened this issue Aug 5, 2021 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@mattjones315
Copy link
Collaborator

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 mattjones315 added enhancement New feature or request help wanted Extra attention is needed labels Aug 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant