Dima Tisnek added the comment:

@Yuri, this bug doesn't require `gather`, here's a version with futures and 
explicit await's instead. It produces same output:

```
import asyncio


async def generator():
    while True:
        x = yield 42
        print("received", x)
        await asyncio.sleep(0.1)


async def user(name, g):
    print("sending", name)
    await g.asend(name)


async def helper():
    g = generator()
    await g.asend(None)

    u0 = asyncio.ensure_future(user("user-0", g))
    u1 = asyncio.ensure_future(user("user-1", g))
    u2 = asyncio.ensure_future(user("user-2", g))

    await u0
    await u1
    await u2


if __name__ == "__main__":
    asyncio.get_event_loop().run_until_complete(helper())
```

Same with `asyncio.get_event_loop().create_task` as well.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30773>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to