>>> root = Node(2) >>> list(root) [2] >>> root.left = Node(1) >>> tuple(root) (1, 2)
(self)
| 17 | right: Node | None = None |
| 18 | |
| 19 | def __iter__(self) -> Iterator[int]: |
| 20 | """ |
| 21 | >>> root = Node(2) |
| 22 | >>> list(root) |
| 23 | [2] |
| 24 | >>> root.left = Node(1) |
| 25 | >>> tuple(root) |
| 26 | (1, 2) |
| 27 | """ |
| 28 | if self.left: |
| 29 | yield from self.left |
| 30 | yield self.data |
| 31 | if self.right: |
| 32 | yield from self.right |
| 33 | |
| 34 | def __len__(self) -> int: |
| 35 | """ |
nothing calls this directly
no outgoing calls
no test coverage detected