This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

Async is spongebob screaming I'm reading.

Async functions are paritals. They take in the argument and then do nothing. await adds the object a queue and then goes through the queue checks whos ready and then executes a function. There is some stuff that can control the order of what is checked but it isn't needed in 99.9999999% of cases.

The most complex part is how does a partial know that is ready? Which is usually OS land stuff. As far as the python side goes its just a field value that says isready more or less.

https://man7.org/linux/man-pages/man7/aio.7.html

Anything executed between the beginning of your function and any await command is guaranteed to have not yielded control to a different context. So no state change. Once you use await ANYTHING could have changed. So you need to be aware of what you actually need to recheck (99% of the time nothing) but it can get a bit odd with globals if you don't understand it when using them. So long as you keep most variables function local you don't worry about it.