(expr, index, oplength=1, stopchar='+-')
return (left, right)
Gets the expressions to the left and right of an operator.

    >>> __getLeftRight('1/(g(x)*3.5)**(x - a**x)/(x**2 + a)', 12,
    ...                oplength=2, stopchar='+-*/')
    ('(g(x)*3.5)', '(x - a**x)')
Gets the expressions to the left and right of an operator.
Gets the expressions to the left and right of an operator .
def __getLeftRight(expr, index, oplength=1, stopchar='+-'):
    """
    Gets the expressions to the left and right of an operator.

    >>> __getLeftRight('1/(g(x)*3.5)**(x - a**x)/(x**2 + a)', 12,
    ...                oplength=2, stopchar='+-*/')
    ('(g(x)*3.5)', '(x - a**x)')

    """
    # assumes correct syntax
    # get left expression
    i = __getClosePos(expr[:index][::-1], ")(", stopchar)
    left = expr[index-i:index]
    i = __getClosePos(expr[index + oplength:], "()", stopchar)
    right = expr[index + oplength:index + oplength + i]
    return (left, right)
def __getLeftRight ( expr , index , oplength = 1 , stopchar = '+-' ) : # assumes correct syntax # get left expression i = __getClosePos ( expr [ : index ] [ : : - 1 ] , ")(" , stopchar ) left = expr [ index - i : index ] i = __getClosePos ( expr [ index + oplength : ] , "()" , stopchar ) right = expr [ index + oplength : index + oplength + i ] return ( left , right )