Skip to content

Commit

Permalink
ubuiltins: Document sum.
Browse files Browse the repository at this point in the history
  • Loading branch information
laurensvalk committed Nov 28, 2022
1 parent f7380b8 commit 334b91f
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/ubuiltins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -837,16 +837,15 @@ def ord(c: _str) -> _int:

def pow(base: Union[_int, _float], exp: Union[_int, _float]) -> Union[_int, _float]:
"""
pow(base, exp) -> int
pow(base, exp) -> float
pow(base, exp) -> Number
Raises the base to the given exponent: :math:`\\text{base}^{\\mathrm{exp}}`.
This is the same as doing ``base ** exp``.
Arguments:
base (int or float): The base.
exp (int or float): The exponent.
base (Number): The base.
exp (Number): The exponent.
Returns:
The result.
Expand Down Expand Up @@ -1069,8 +1068,17 @@ def sum(iterable: Iterable, start: _int) -> _int:

def sum(*args):
"""
Sums ``start`` and the items of an ``iterable`` from left to right and
returns the total.
sum(iterable) -> Number
sum(iterable, start) -> Number
Sums the items from the iterable and the start value.
Arguments:
iterable (iter): Values to be summed, starting with the first value.
start (Number): Value added to the total.
Returns:
The total sum.
"""


Expand Down

0 comments on commit 334b91f

Please sign in to comment.