First page Back Continue Last page Overview Graphics

Infinite Iterators: repeat

repeat(object [,times])

repeat creates an iterator which returns the object for the specified number of times. If the optional parameter times is not specified, it will return the object endlessly.

Example:

>>> repeat("a", 10)

repeat('a', 10)

>>> list(repeat("a", 10))

['a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a']