Send data to asyncio coroutine

jcarmena at gmail.com jcarmena at gmail.com
Tue Jul 21 13:31:29 CEST 2015


Hello, I'm trying to understand and link asyncio with ordinary coroutines. Now I just want to understand how to do this on asyncio:


def foo():
    data = yield 8
    print(data)
    yield "bye"
    
def bar():
    f = foo()
    n = f.next()
    print(n)
    message = f.send("hello")
    print(message)


What is the equivalent for coro.send("some data") in asyncio?

coro.send on an asyncio coroutine throws AssertionError: yield from wasn't used with future.


Thank you


More information about the Python-list mailing list