(self, n=None)
return result.left(root)
Produce a nice root symbol.
        Produces ugly results for big n inserts.
Produce a nice root symbol.
        Produces ugly results for big n inserts.
Produce a nice root symbol . Produces ugly results for big n inserts .
def root(self, n=None):
        """Produce a nice root symbol.
        Produces ugly results for big n inserts.
        """
        # XXX not used anywhere
        # XXX duplicate of root drawing in pretty.py
        #put line over expression
        result = self.above('_'*self.width())
        #construct right half of root symbol
        height = self.height()
        slash = '\n'.join(
            ' ' * (height - i - 1) + '/' + ' ' * i
            for i in range(height)
        )
        slash = stringPict(slash, height - 1)
        #left half of root symbol
        if height > 2:
            downline = stringPict('\\ \n \\', 1)
        else:
            downline = stringPict('\\')
        #put n on top, as low as possible
        if n is not None and n.width() > downline.width():
            downline = downline.left(' '*(n.width() - downline.width()))
            downline = downline.above(n)
        #build root symbol
        root = downline.right(slash)
        #glue it on at the proper height
        #normally, the root symbel is as high as self
        #which is one less than result
        #this moves the root symbol one down
        #if the root became higher, the baseline has to grow too
        root.baseline = result.baseline - result.height() + root.height()
        return result.left(root)
def root ( self , n = None ) : # XXX not used anywhere # XXX duplicate of root drawing in pretty.py #put line over expression result = self . above ( '_' * self . width ( ) ) #construct right half of root symbol height = self . height ( ) slash = '\n' . join ( ' ' * ( height - i - 1 ) + '/' + ' ' * i for i in range ( height ) ) slash = stringPict ( slash , height - 1 ) #left half of root symbol if height > 2 : downline = stringPict ( '\\ \n \\' , 1 ) else : downline = stringPict ( '\\' ) #put n on top, as low as possible if n is not None and n . width ( ) > downline . width ( ) : downline = downline . left ( ' ' * ( n . width ( ) - downline . width ( ) ) ) downline = downline . above ( n ) #build root symbol root = downline . right ( slash ) #glue it on at the proper height #normally, the root symbel is as high as self #which is one less than result #this moves the root symbol one down #if the root became higher, the baseline has to grow too root . baseline = result . baseline - result . height ( ) + root . height ( ) return result . left ( root )