(self)
Generator that returns the leaves of the tree
Generator that returns the leaves of the tree
Generator that returns the leaves of the tree
def leaves(self):
        "Generator that returns the leaves of the tree"
        for child in self.children:
            yield from child.leaves()
        if not self.children:
            yield self
def leaves ( self ) : for child in self . children : yield from child . leaves ( ) if not self . children : yield self