If I have an event loop and an asynchronous function:
import asyncio
async def hello_world():
print('Hello World')
await good_evening()
async def good_evening():
print('Good Evening')
loop = asyncio.get_event_loop()
try:
loop.run_until_complete(hello_world())
loop.run_forever()
finally:
print('closing event loop')
loop.close()
The hellp_world function is called by eventloop. The second good_evening function is in the same eventloop or not?
Is it necessary to include the second function in the loop or only the first? If I use this example, the second use cycle and context switching?
source
share