News for hackers. Stuff that matters.
Re:A viable solution for Python concurrency by justusw on Friday October 15, 2021 @10:34PM (#28885098)
I’m not an expert on Node.js but I was always under the impression that you couldn’t write await outside of an async function. Has that changed recently?
Re:A viable solution for Python concurrency by BiteCode_dev on Saturday October 16, 2021 @04:50AM (#28886477)
You can await at the top level of a module since node v14.8.

It has been proposed to Python: https://groups.google.com/g/python-ideas/c/PN1_j7Md4j0/m/0xy...

But I have no more info about it.

Re:A viable solution for Python concurrency by shauns on Saturday October 16, 2021 @03:14AM (#28886154)
You are right that you can only await in an async function, but you can call an async function anywhere and get back a Promise.

await-ing that promise is often what you want to do but there are other ways to do work once the promise has resolved.