SZanlongo
7/28/2016 - 2:38 PM

Element-wise addition of tuples

Element-wise addition of tuples

def add_tuples(a, b):
    """
    Element-wise addition of tuples
    :param a: tuple
    :param b: tuple
    :return: n-tuple
    """
    return tuple(map(operator.add, a, b))