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

Method __iter__

sorts/tree_sort.py:19–24  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

17 right: Node | None = None
18
19 def __iter__(self) -> Iterator[int]:
20 if self.left:
21 yield from self.left
22 yield self.val
23 if self.right:
24 yield from self.right
25
26 def __len__(self) -> int:
27 return sum(1 for _ in self)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected