#NEWLINE# def sum( self , projection = None ) : #NEWLINE# #INDENT# '\n        Takes sum of elements in sequence.\n\n        >>> seq([1, 2, 3, 4]).sum()\n        10\n\n        >>> seq([(1, 2), (1, 3), (1, 4)]).sum(lambda x: x[0])\n        3\n\n        :param projection: function to project on the sequence before taking the sum\n        :return: sum of elements in sequence\n        ' #NEWLINE# if projection : #NEWLINE# #INDENT# return sum ( self . map ( projection ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return sum ( self )