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 DataTree.orphan act in-place? #9674

Open
TomNicholas opened this issue Oct 24, 2024 · 1 comment
Open

Should DataTree.orphan act in-place? #9674

TomNicholas opened this issue Oct 24, 2024 · 1 comment
Labels
API design topic-DataTree Related to the implementation of a DataTree class

Comments

@TomNicholas
Copy link
Member

TomNicholas commented Oct 24, 2024

What is your issue?

DataTree.orphan remove the parent node from a tree, but modifies in-place. It has no return value, so it's already consistent with #9196. But it's not obvious to me whether or not the method should return a modified copy instead.

came up here #9666 (comment)

cc @keewis @shoyer

@TomNicholas TomNicholas added API design topic-DataTree Related to the implementation of a DataTree class labels Oct 24, 2024
@shoyer
Copy link
Member

shoyer commented Oct 25, 2024

I have had similar thoughts.

The non-inplace version is currently spelled DataTree.copy(). But the name is not so intuitive.

Something like tree['child'].orphan(inherit=False) would be much cleaner than tree['child'].copy(inherit=False).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API design topic-DataTree Related to the implementation of a DataTree class
Projects
None yet
Development

No branches or pull requests

2 participants