I'm trying to wrapping my head around asyncio
. I think I'm rather confident using MultiThreads and I think that confuses me, since I keep mapping asyncio back to MultiThreads.
Say I have the following
async def get_url_data(url):
data = await some_api_call()
return data
as far as I understand; when we encounter await
it's like saying "Run this function in the background and move on" - but some say that await
"gives control back to the event loop". Does that mean that await
"pauses" the function (or schedules it?) or is it, as I understood, that await
makes the function run in the background? I struggle to figure out when the function is executed and the values are returned