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

Method __iter__

data_structures/binary_tree/mirror_binary_tree.py:23–28  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

21 right: Node | None = None
22
23 def __iter__(self) -> Iterator[int]:
24 if self.left:
25 yield from self.left
26 yield self.value
27 if self.right:
28 yield from self.right
29
30 def __len__(self) -> int:
31 return sum(1 for _ in self)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected