Mar-23-2019, 07:48 AM
(This post was last modified: Mar-23-2019, 07:48 AM by AlekseyPython.)
Python 3.5
I have an object, one of the methods of which is coroutine:
I have an object, one of the methods of which is coroutine:
class A:
def __init__(self):
self.number = random.random()
async def my_method(self):
asyncio.sleep(1)
print('Hello, world!')I create task:async def add_task(tasks:list):
a = A()
coro = a.my_method()
task = asyncio.create_task(coro)
tasks.append(task)How can I get object 'a' from tasks[0]?
