top | item 46056786

(no title)

mikkelam | 3 months ago

I agree. If you strictly follow the syntax of "Example 1" in JavaScript (calling and awaiting on the same line), the observable output is identical to Python.

I suppose the author meant to say that if you first called your async function and then later did `await` you would have different behavior.

discuss

order

misiek08|3 months ago

In every language having any kind of asynchronous features you should get exactly same result. Other comments already mentioned how the example should look and how it differs.

In short: having other coroutine working and awaiting e.g. on sleep() you can get anything between „parent before” and „child start”. In Python is impossible, because child is not run as new task.