anext

awaitable anext(async_iterator [,default])

Returns the next item from a given asynchronous iterator (built-in).

arglistThe comma separated list of values (Array / Variant).

REMARKS
* This is a built-in function.
* When awaited, return the next item from the given asynchronous iterator, or default if given and the iterator is exhausted.
* This is the async variant of the next() builtin, and behaves similarly.
* This calls the __anext__() method of async_iterator, returning an awaitable. Awaiting this returns the next value of the iterator. If default is given, it is returned if the iterator is exhausted, otherwise StopAsyncIteration is raised.
* You can use the next function
* For the Official documentation refer to python.org

# A built-in asynchronous function (Python 3.10+) that retrieves the next item from an asynchronous iterator. 
async def demo(it):
    value = await anext(it)
    print(value)

© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited Top