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

Should *Cloner methods be mapped to __copy__ or __deepcopy__ magic methods #12

Closed
tclose opened this issue May 25, 2015 · 3 comments
Closed
Labels

Comments

@tclose
Copy link
Contributor

tclose commented May 25, 2015

I can't work out whether *Cloner methods should be mapped to __copy__ or __deepcopy__ magic methods. In fact I am not sure the point of the cloner visitors are the first place, as __deepcopy__ should do the job no?

@apdavison
Copy link
Member

I don't know without spending a lot more time with the code. I think the use of the Visitor pattern is possibly overkill here.

@tclose
Copy link
Contributor Author

tclose commented Jul 14, 2016

I just ran into a problem trying to deepcopy an object where it copied the document it belonged to as well, since all "document-level" objects contain a reference to the document they belong to. So having cloner methods is probably a good idea. Maybe all classes should implement a 'clone(self)' method for consistency between abstraction and user (property/state) layers.

@tclose
Copy link
Contributor Author

tclose commented Jul 5, 2017

I have decided that having separate deepcopy and cloner methods is probably a good idea

@tclose tclose closed this as completed Jul 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants