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

Add a public read-only parent property to TreeNode #1488

Merged
merged 3 commits into from
Jan 6, 2023

Conversation

davep
Copy link
Contributor

@davep davep commented Jan 5, 2023

See #1397.

@davep davep added the enhancement New feature or request label Jan 5, 2023
@davep davep linked an issue Jan 5, 2023 that may be closed by this pull request
@davep davep merged commit 82fe3e2 into Textualize:main Jan 6, 2023
@davep davep deleted the tree-node-parent-prop branch January 6, 2023 12:18
child = tree.root.add("Leia")
grandchild = child.add("Ben")
assert tree.root.parent is None
assert grandchild.parent == child
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(apologies if this in nit'ting, I don't mean it as such) I think it might be better to change this == and the one below to is. Basically I submit that this is the contract -- you get back a node that IS the parent, not just "looks the same". Or at least that's what I think the contract should be.

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

Successfully merging this pull request may close these issues.

[Tree] Add a read-only parent property to TreeNode
3 participants