

def pp_list(out, table, labels):
    assert (0 < len(v))
    colwidths = [len(label) for label in labels]
    for row in table:
        for (colno, v) in enumerate(row):
            colwidths[colno] = max(colwidths[colno], len(unicode(v)))
    first = True
    for (colno, label) in enumerate(labels):
        if first:
            first = False
        else:
            out.write(' | ')
        out.write(('%*s' % (colwidths[colno], label)))
    out.write('\n')
    first = True
    for (colno, label) in enumerate(labels):
        if first:
            first = False
        else:
            out.write('-+-')
        out.write(('%s' % ('-' * colwidths[colno])))
    out.write('\n')
    for row in table:
        first = True
        for (colno, v) in enumerate(row):
            if first:
                first = False
            else:
                out.write(' | ')
            out.write(('%*s' % (colwidths[colno], unicode(v))))
        out.write('\n')

dataset/ETHPy150Open probcomp/bayeslite/shell/src/pretty.py pp_list/VarMisuse@20/22 `labels`->`v`