def sum(self, selector=identity):
        '''Return the arithmetic sum of the values in the sequence..

        All of the source sequence will be consumed.

        Note: This method uses immediate execution.

        Args:
            selector: An optional single argument function which will be used
                to project the elements of the sequence. If omitted, the
                identity function is used.

        Returns:
            The total value of the projected sequence, or zero for an empty
            sequence.

        Raises:
            ValueError: If the Queryable has been closed.
        '''

        if self.closed():
            raise ValueError("Attempt to call sum() on a closed Queryable.")

        if not is_callable(selector):
            raise TypeError("sum() parameter selector={0} is "
                            "not callable".format(repr(selector)))

        return sum(self.select(selector))
Return the arithmetic sum of the values in the sequence..

        All of the source sequence will be consumed.

        Note: This method uses immediate execution.

        Args:
            selector: An optional single argument function which will be used
                to project the elements of the sequence. If omitted, the
                identity function is used.

        Returns:
            The total value of the projected sequence, or zero for an empty
            sequence.

        Raises:
            ValueError: If the Queryable has been closed.