def part_sum(x, i=0):
    """All subsetsums from x[i:]

    :param x: table of values
    :param int i: index defining suffix of x to be considered
    :iterates: over all values, in arbitrary order
    :complexity: :math:`O(2^{len(x)-i})`
    """
    if i == len(x):
        yield 0
    else:
        for s in part_sum(x, i + 1):
            yield s
            yield s + x[i]
All subsetsums from x[i:]

    :param x: table of values
    :param int i: index defining suffix of x to be considered
    :iterates: over all values, in arbitrary order
    :complexity: :math:`O(2^{len(x)-i})`