(*args)
return '\n'.join(newPicture), newBaseline
Put pictures on top of each other,
        from top to bottom.
        Returns string, baseline arguments for stringPict.
        The baseline is the baseline of the second picture.
        Everything is centered.
        Baseline is the baseline of the second picture.
        Strings are allowed.
        The special value stringPict.LINE is a row of '-' extended to the width.
Put pictures on top of each other,
        from top to bottom.
        Returns string, baseline arguments for stringPict.
        The baseline is the baseline of the second picture.
        Everything is centered.
        Baseline is the baseline of the second picture.
        Strings are allowed.
        The special value stringPict.LINE is a row of '-' extended to the width.
Put pictures on top of each other from top to bottom . Returns string baseline arguments for stringPict . The baseline is the baseline of the second picture . Everything is centered . Baseline is the baseline of the second picture . Strings are allowed . The special value stringPict . LINE is a row of - extended to the width .
def stack(*args):
        """Put pictures on top of each other,
        from top to bottom.
        Returns string, baseline arguments for stringPict.
        The baseline is the baseline of the second picture.
        Everything is centered.
        Baseline is the baseline of the second picture.
        Strings are allowed.
        The special value stringPict.LINE is a row of '-' extended to the width.
        """
        #convert everything to stringPicts; keep LINE
        objects = []
        for arg in args:
            if arg is not stringPict.LINE and isinstance(arg, string_types):
                arg = stringPict(arg)
            objects.append(arg)

        #compute new width
        newWidth = max(
            obj.width()
            for obj in objects
            if obj is not stringPict.LINE)

        lineObj = stringPict(hobj('-', newWidth))

        #replace LINE with proper lines
        for i, obj in enumerate(objects):
            if obj is stringPict.LINE:
                objects[i] = lineObj

        #stack the pictures, and center the result
        newPicture = []
        for obj in objects:
            newPicture.extend(obj.picture)
        newPicture = [line.center(newWidth) for line in newPicture]
        newBaseline = objects[0].height() + objects[1].baseline
        return '\n'.join(newPicture), newBaseline
def stack ( * args ) : #convert everything to stringPicts; keep LINE objects = [ ] for arg in args : if arg is not stringPict . LINE and isinstance ( arg , string_types ) : arg = stringPict ( arg ) objects . append ( arg ) #compute new width newWidth = max ( obj . width ( ) for obj in objects if obj is not stringPict . LINE ) lineObj = stringPict ( hobj ( '-' , newWidth ) ) #replace LINE with proper lines for i , obj in enumerate ( objects ) : if obj is stringPict . LINE : objects [ i ] = lineObj #stack the pictures, and center the result newPicture = [ ] for obj in objects : newPicture . extend ( obj . picture ) newPicture = [ line . center ( newWidth ) for line in newPicture ] newBaseline = objects [ 0 ] . height ( ) + objects [ 1 ] . baseline return '\n' . join ( newPicture ) , newBaseline