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

Method __len__

data_structures/binary_tree/basic_binary_tree.py:20–21  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

18 yield from self.right
19
20 def __len__(self) -> int:
21 return sum(1 for _ in self)
22
23 def is_full(self) -> bool:
24 if not self or (not self.left and not self.right):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected