aioplus.anextify

aioplus.anextify(iterable, /, *, executor=None)

Make iterable asynchronous.

Parameters:
  • iterable (Iterable[T]) – Iterable.

  • executor (ThreadPoolExecutor, optional) – Executor.

Returns:

Iterator.

Return type:

AsyncIterator[T]

Notes

  • If executor is None, then the default one is used (usually, a thread pool).

Examples

>>> iterable = [0, 1, 2, 3, 4, 5]
>>> aiterable = anextify(iterable)
>>> [num async for num in aiterable]
[0, 1, 2, 3, 4, 5]