Send data to asyncio coroutine

jcarmena at gmail.com jcarmena at gmail.com
Tue Jul 21 07:31:29 EDT 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