The example from this StackOverflow question might be a better demonstration: https://stackoverflow.com/q/63455683
The example from this StackOverflow question might be a better demonstration: https://stackoverflow.com/q/63455683
> My mutation block contained no awaits. The only awaits happened before acquiring the lock. Therefore:
> * The critical section was atomic relative to the event loop.
> * No other task could interleave inside the mutation.
> * More locks would not increase safety.
That is exactly the same as with e.g. JS. I'm sure there are lot of subtle differences in how Python does async vs others, but the article fails to illuminate any of it; neither the framing story nor the examples really clarify anything
[1] https://babeljs.io/docs/babel-plugin-transform-async-to-gene...
So in your example the behavior is much more obvious if you sort of desugar it as
async function parent() {
print("parent before");
const p = child();
await p
print("parent after");
}