aioplus.arepeat

aioplus.arepeat(obj, /, *, times=None)

Yield the same object repeatedly, either infinitely or a fixed number of times.

Parameters:
  • obj (T) – The object to yield repeatedly.

  • times (int, optional) – Number of repetitions. Must be an object supporting object.__index__(). If None, the object is yielded indefinitely.

Returns:

An asynchronous iterable yielding the same object multiple times.

Return type:

AsyncIterable of T

Examples

>>> [num async for num in arepeat(23, times=4)]
[23, 23, 23, 23]