MCPcopy Create free account
hub / github.com/bslatkin/effectivepython / _traverse

Method _traverse

example_code/item_057.py:89–94  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

87print("Example 6")
88class IndexableNode(BinaryNode):
89 def _traverse(self):
90 if self.left is not None:
91 yield from self.left._traverse()
92 yield self
93 if self.right is not None:
94 yield from self.right._traverse()
95
96 def __getitem__(self, index):
97 for i, item in enumerate(self._traverse()):

Callers 2

__getitem__Method · 0.95
__len__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected