iota/trits.py
def add_trits(left, right):
    # type: (Sequence[int], Sequence[int]) -> List[int]
    """
    Adds two sequences of trits together.

    The result is a list of trits equal in length to the longer of the
    two sequences.

    .. note::
        Overflow is possible.

        For example, ``add_trits([1], [1])`` returns ``[-1]``.
    """
    target_len = max(len(left), len(right))

    res = [0] * target_len
    left += [0] * (target_len - len(left))
    right += [0] * (target_len - len(right))

    carry = 0
    for i in range(len(res)):
        res[i], carry = _full_add_trits(left[i], right[i], carry)

    return res
def add_trits(left, right):
    # type: (Sequence[int], Sequence[int]) -> List[int]
    target_len = max(len(left), len(right))

    res = [0] * target_len
    left += [0] * (target_len - len(left))
    right += [0] * (target_len - len(right))

    carry = 0
    for i in range(len(res)):
        res[i], carry = _full_add_trits(left[i], right[i], carry)

    return res
def add_trits ( left , right ) : # type: (Sequence[int], Sequence[int]) -> List[int] target_len = max ( len ( left ) , len ( right ) ) res = [ 0 ] * target_len left += [ 0 ] * ( target_len - len ( left ) ) right += [ 0 ] * ( target_len - len ( right ) ) carry = 0 for i in range ( len ( res ) ) : res [ i ] , carry = _full_add_trits ( left [ i ] , right [ i ] , carry ) return res
Adds two sequences of trits together.

    The result is a list of trits equal in length to the longer of the
    two sequences.

    .. note::
        Overflow is possible.

        For example, ``add_trits([1], [1])`` returns ``[-1]``.
Adds two sequences of trits together .