def optimize_accum(ls):
    end = len(ls)
    while end > 0:
        beg = end - 1
        while beg >= 0 and isinstance(ls[beg], str):
            beg = beg - 1
        if end >= beg + 3:
            ls[beg+1:end] = (''.join(ls[beg+1:end]),)
        end = beg
    return
Given a list of strings and other objects, concatenate all the strings.
dataset/ETHPy150Open erkyrath/tworld/lib/two/evalctx.py/optimize_accum