(self, *others)
return prettyForm(binding=bin, *stringPict.next(*result))
Make a pretty multiplication.
        Parentheses are needed around +, - and neg.
Make a pretty multiplication.
        Parentheses are needed around +, - and neg.
Make a pretty multiplication . Parentheses are needed around + - and neg .
def __mul__(self, *others):
        """Make a pretty multiplication.
        Parentheses are needed around +, - and neg.
        """
        if len(others) == 0:
            return self # We aren't actually multiplying... So nothing to do here.

        args = self
        if args.binding > prettyForm.MUL:
            arg = stringPict(*args.parens())
        result = [args]
        for arg in others:
            result.append(xsym('*'))
            #add parentheses for weak binders
            if arg.binding > prettyForm.MUL:
                arg = stringPict(*arg.parens())
            result.append(arg)
        len_res = len(result)
        for i in xrange(len_res):
            if i < len_res - 1 and result[i] == '-1' and result[i + 1] == xsym('*'):
                # substitute -1 by -, like in -1*x -> -x
                result.pop(i)
                result.pop(i)
                result.insert(i, '-')
        if result[0][0] == '-':
            # if there is a - sign in front of all
            # This test was failing to catch a prettyForm.__mul__(prettyForm("-1", 0, 6)) being negative
            bin = prettyForm.NEG
        else:
            bin = prettyForm.MUL
        return prettyForm(binding=bin, *stringPict.next(*result))
def __mul__ ( self , * others ) : if len ( others ) == 0 : return self # We aren't actually multiplying... So nothing to do here. args = self if args . binding > prettyForm . MUL : arg = stringPict ( * args . parens ( ) ) result = [ args ] for arg in others : result . append ( xsym ( '*' ) ) #add parentheses for weak binders if arg . binding > prettyForm . MUL : arg = stringPict ( * arg . parens ( ) ) result . append ( arg ) len_res = len ( result ) for i in xrange ( len_res ) : if i < len_res - 1 and result [ i ] == '-1' and result [ i + 1 ] == xsym ( '*' ) : # substitute -1 by -, like in -1*x -> -x result . pop ( i ) result . pop ( i ) result . insert ( i , '-' ) if result [ 0 ] [ 0 ] == '-' : # if there is a - sign in front of all # This test was failing to catch a prettyForm.__mul__(prettyForm("-1", 0, 6)) being negative bin = prettyForm . NEG else : bin = prettyForm . MUL return prettyForm ( binding = bin , * stringPict . next ( * result ) )