Managing Attribute Deletion
Managing Attribute Deletion. It’s possible to create properties that implement deletion functionality. This might be a rare use case of
property(), but having a way to delete an attribute can be handy in some situations.
00:29 Each node in a tree has a parent node, except for the root node. Nodes can have zero or more children. Now suppose you need to provide a way to delete or clear the list of children of a given node.
TreeNode represents a node in your custom tree data type. Each node stores its children in a Python list. You then implement
.children as a property to manage the underlying list of children.
Become a Member to join the conversation.