On this page
  1. anext
  2. Import & Availability
  3. Overview & Signature
  4. Usage
  5. Gotchas
  6. REPL Inspect

anext

Prev: all | Up: __builtins__ | Next: any
Rel: all, any, enumerate, filter, iter
Ref: docs.python.org — anext
Tags: #public #python3 #builtins


Import & Availability

# Built-in (available globally without import)
from builtins import anext

Overview & Signature

anext(...)

Return the next item from the async iterator.

Usage

import asyncio

async def gen():
    yield 10

async def main():
    it = aiter(gen())
    assert await anext(it) == 10
    assert await anext(it, None) is None

asyncio.run(main())

Gotchas

REPL Inspect

help(anext)

Linked from

Related notes