diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst index 7099fa0..155e010 100644 --- a/Doc/library/itertools.rst +++ b/Doc/library/itertools.rst @@ -519,21 +519,21 @@ loops that truncate the stream. yield tuple(prod) -.. function:: repeat(object[, times]) +.. function:: repeat(element[, times]) - Make an iterator that returns *object* over and over again. Runs indefinitely + Make an iterator that returns *element* over and over again. Runs indefinitely unless the *times* argument is specified. Used as argument to :func:`map` for invariant parameters to the called function. Also used with :func:`zip` to create an invariant part of a tuple record. Equivalent to:: - def repeat(object, times=None): + def repeat(element, times=None): # repeat(10, 3) --> 10 10 10 if times is None: while True: - yield object + yield element else: for i in range(times): - yield object + yield element A common use for *repeat* is to supply a stream of constant values to *map* or *zip*:: diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c index 644104e..a0b90ef 100644 --- a/Modules/itertoolsmodule.c +++ b/Modules/itertoolsmodule.c @@ -4127,8 +4127,8 @@ static PyMethodDef repeat_methods[] = { }; PyDoc_STRVAR(repeat_doc, -"repeat(object [,times]) -> create an iterator which returns the object\n\ -for the specified number of times. If not specified, returns the object\n\ +"repeat(element [,times]) -> create an iterator which returns the element\n\ +for the specified number of times. If not specified, returns the element\n\ endlessly."); static PyTypeObject repeat_type = {