MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / __iter__

Method __iter__

data_structures/binary_tree/is_sum_tree.py:75–80  ·  view source on GitHub ↗

>>> list(BinaryTree.build_a_tree()) [1, 2, 7, 11, 15, 29, 35, 40]

(self)

Source from the content-addressed store, hash-verified

73 root: Node
74
75 def __iter__(self) -> Iterator[int]:
76 """
77 >>> list(BinaryTree.build_a_tree())
78 [1, 2, 7, 11, 15, 29, 35, 40]
79 """
80 return iter(self.root)
81
82 def __len__(self) -> int:
83 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected