kristjanvalur / py-asynkit

Tools for Python coroutines and advanced scheduling for `asyncio`
MIT License
13 stars 1 forks source link

add the coro_iter() utility #12

Closed kristjanvalur closed 1 year ago

kristjanvalur commented 1 year ago

coro_iter() returns a generator which implements the await protocol. This allows it to be returned from an object.__await__() method, but this method must return an iterator and not a coroutine.
This makes it simpler to make objects awaitable by allowing coroutines to feed the __await__() method.