skbio.tree.TreeNode.extend

TreeNode.extend(nodes)[source]

Append a list of TreeNode to self.

State: Experimental as of 0.4.0.

extend will invalidate any node lookup caches, remove existing parents of the nodes if they have any, set their parents to self and add the nodes to self children.

Parameters

nodes (list of TreeNode) – A list of TreeNode objects

See also

append()

Examples

>>> from skbio import TreeNode
>>> root = TreeNode(name="root")
>>> root.extend([TreeNode(name="child1"), TreeNode(name="child2")])
>>> print(root)
(child1,child2)root;