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

The copy method on Variables does not work as expected #32

Open
jrising opened this issue Nov 25, 2019 · 0 comments
Open

The copy method on Variables does not work as expected #32

jrising opened this issue Nov 25, 2019 · 0 comments

Comments

@jrising
Copy link
Member

jrising commented Nov 25, 2019

MetaCSV objects support a copy method, which applies copy to all the contained information, including the variables, going so far as to create a new Variables object in the new MetaCSV object. But changing the newly copied object changes the original. This is because the final copy is not a deep-copy, and all content, like units and descriptions, are a second level deep.

I currently work around this by saying:

newcsv['variables']._data = copy.deepcopy(newcsv['variables']._data)

before updating information in the variables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant