[Async-sig] PEP: asynchronous generators

Герасимов Михаил Gerasimov-M-N at yandex.ru
Sun Jul 31 06:23:31 EDT 2016


> It will be a very rare case — you need a generator that produces an infinite series of values with a try..finally block.

If I'm not mistaken it'll be any generator with `break` before it 
yieldedlast value(and with try...finally block that is usually context 
manager).

    def gen():
    async with cm_long_aexit():
    yield 1
    yield 2
    yield 3

    async for i in gen():
    if i == 2: break


> We can maintain a weak set of ‘aclose’ tasks in the event loop, and make it a public and documented property.  That way you’ll be able to call gather() with a timeout on that list before closing the loop.

It solves the issue.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/async-sig/attachments/20160731/d4892099/attachment.html>


More information about the Async-sig mailing list