def sum(a):
    """
    Returns the sum of the elements of a.
    """
    try:
	return reduce(lambda x, y: x+y, a, 0)
    except:
	raise TypeError, 'vector::FAILURE in sum'

    Returns the sum of the elements of a.
    
recipes/Python/52272_vector_list_based_vector_class_supporting/recipe-52272.py