On Wed, Nov 30, 2016 at 1:29 AM, Frank Millman <fr...@chagford.com> wrote: > "Marko Rauhamaa" wrote in message news:87d1hd4d5k....@elektro.pacujo.net... >> >> >> One of the more useful ones might be: >> >> o = await anext(ait) >> > > Definitely! > > But I found it easy to write my own - > > async def anext(aiter): > return await aiter.__anext__()
Even simpler: def anext(aiter): return aiter.__anext__() As a general rule, if the only await in a coroutine is immediately prior to the return, then it doesn't need to be a coroutine. Just return the thing it's awaiting so that the caller can be rid of the middle man and await it directly. -- https://mail.python.org/mailman/listinfo/python-list