skbio.tree.TreeNode.pop

TreeNode.pop(index=-1)[source]

Remove a TreeNode from self.

State: Experimental as of 0.4.0.

Remove a child node by its index position. All node lookup caches are invalidated, and the parent reference for the popped node will be set to None.

Parameters

index (int) – The index position in children to pop

Returns

The popped child

Return type

TreeNode

Examples

>>> from skbio import TreeNode
>>> tree = TreeNode.read(["(a,b)c;"])
>>> print(tree.pop(0))
a;