peng/functions.py
def _pair_delims(expr, ldelim="(", rdelim=")"):
    """Pair delimiters."""
    # Find where remaining delimiters are
    lindex = reversed([num for num, item in enumerate(expr) if item == ldelim])
    rindex = [num for num, item in enumerate(expr) if item == rdelim]
    # Pair remaining delimiters
    return [(lpos, _next_rdelim(rindex, lpos)) for lpos in lindex][::-1]
def _pair_delims(expr, ldelim="(", rdelim=")"):
    # Find where remaining delimiters are
    lindex = reversed([num for num, item in enumerate(expr) if item == ldelim])
    rindex = [num for num, item in enumerate(expr) if item == rdelim]
    # Pair remaining delimiters
    return [(lpos, _next_rdelim(rindex, lpos)) for lpos in lindex][::-1]
def _pair_delims ( expr , ldelim = "(" , rdelim = ")" ) : # Find where remaining delimiters are lindex = reversed ( [ num for num , item in enumerate ( expr ) if item == ldelim ] ) rindex = [ num for num , item in enumerate ( expr ) if item == rdelim ] # Pair remaining delimiters return [ ( lpos , _next_rdelim ( rindex , lpos ) ) for lpos in lindex ] [ : : - 1 ]
Pair delimiters.
Pair delimiters .