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

Method __iter__

data_structures/binary_tree/floor_and_ceiling.py:25–30  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected