frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

How async/await works in Python (2021)

https://tenthousandmeters.com/blog/python-behind-the-scenes-12-how-asyncawait-works-in-python/
61•sebg•1y ago

Comments

quentinp•1y ago
While it stays at the Python level, https://github.com/AndreLouisCaron/a-tale-of-event-loops really helped me to understand how asyncio and Trio are implemented. I had no idea how sleeps worked before reading that post.
incomingpain•1y ago
Page didnt load for me.

https://realpython.com/async-io-python/

Multiprocessing all the way!

emmelaich•1y ago
(2021)

Good article!

punnerud•1y ago
A more simplified version:

Synchronous code is like a single-lane road where cars (tasks) must travel one after another in perfect sequence. If one car stops for gas (waiting for I/O), every car behind it must stop too. While orderly and predictable, this creates massive traffic jams as tasks wait unnecessarily for others to complete before they can proceed.

Pure asynchronous code (with callbacks) is like dispatching multiple cars onto independent routes with no coordination. Cars move freely without waiting for each other, but they arrive at unpredictable times and following their progress becomes chaotic. It's efficient but creates a complex tangle of paths that becomes hard to maintain.

Async/await combines the best of both approaches with a multi-lane highway system. Cars follow clear, synchronous-looking routes (making code readable), but only wait at strategic "await" exit ramps when truly necessary. When a car needs data, it signals with "await", pulls off the highway temporarily, and other cars continue flowing past. Once its operation completes, it merges back into traffic and continues. This gives you the logical simplicity of synchronous code with the performance benefits of asynchronous execution - cars only wait at crossroads when they must, maximizing throughput while maintaining order.

The genius of async/await is that it lets developers write code that looks sequential while the runtime handles all the complex traffic management under the hood.

explodes•1y ago
Excellent write up. I appreciate the level of details here showing the history from the days of old, before async/await were even keywords.
bilsbie•1y ago
How does the GIL come into play here?
punnerud•1y ago
GIL is like a "red-cap" on the head for the CPU-core running the task, so you would not be able to run true Async without GIL. Have to hand the "red-cap" back, for the next task.

Instead of using a global lock ("red-cap"), Python objects have introduced a specialized reference counting system that distinguishes between "local" references (owned by a single thread) and "shared" references (accessed by multiple threads).

In that way enabling to remove GIL in the long run, now starting with making it optional.

Quad9 Is Leaving France: Why DNS Resolvers Are the Wrong Place to Fight Piracy

https://techstackups.com/articles/quad9-leaves-france-dns-blocking/
227•ritzaco•2h ago•47 comments

'Human' Is Cambridge Dictionary's Word of the Year 2026

https://www.cam.ac.uk/news/cambridge-dictionary-reveals-word-of-the-year-2026
47•DeepLogin•47m ago•15 comments

Energy-Based Reasoners: 385x more efficient inference

https://energy-based-reasoners.github.io/
210•frenchmajesty•6h ago•29 comments

A Perfect SimCity

https://www.jeffquast.com/post/a-perfect-simcity/
143•mariuz•3d ago•51 comments

When AI Knows More Than It Can Offer

https://medium.com/@smoking2man/when-ai-knows-more-than-it-can-offer-how-training-turns-an-intell...
46•Aldus551•2d ago•22 comments

Java4Shell: RCE in OpenJDK when processing Base64

https://calif.io/java4shell/
1086•werrett•18h ago•291 comments

Can Peer Review Survive AI-Generated Text? [pdf]

https://www.sas.upenn.edu/~jesusfv/Peer_Review.pdf
48•torutofu•1h ago•48 comments

Google's AI answers reducing search traffic by 40%

https://revscope.co/blog/search-seo-geo-2026/
607•slashdev•15h ago•453 comments

Quad9's withdrawal from France: A canary in the coal mine

https://blog.cloudflare.com/quad9-withdrawal-from-france/
826•subset•17h ago•376 comments

Show HN: Type Fighter 2

https://typefighter2.com/
60•torumitch•4h ago•25 comments

Pre-auth RCE in Nginx HTTP/2 handling

https://www.wiz.io/blog/nginx-http2-rce-vulnerabilities
4•speedping•11m ago•0 comments

ID.me terms required for IRS sign-in

https://consumerrights.wiki/w/ID.me_terms_required_for_IRS_sign-in
433•DeepLogin•14h ago•225 comments

Evidence (YC S21) Is Hiring

https://www.ycombinator.com/companies/evidence/jobs/1xb9PpP-founding-gtm-lead
1•amcaskill•3h ago

IPv6 delegation, an unusually subtle failure mode

https://savyasacheejha.com/posts/why-odhcpd/
43•genghizkhan•2d ago•29 comments

Why is Gemini 4 Carbon taking so long?

https://kernel.dev/blog/why-is-gemini-4-carbon-taking-so-long/
211•deenadz•11h ago•105 comments

Energy drinks linked to 11 times more reports of cardiac arrest

https://www.sciencedaily.com/releases/2026/11/261110042543.htm
39•wjSgoWPm5bWAhXB•1h ago•18 comments

Nvidia stopped disclosing Singapore sales as revenues hit $104B

https://www.ft.com/content/dbde7a30-548c-4f9d-a4be-7898a0c24dcf
632•louiereederson•22h ago•282 comments

The x86 CPU: From 4004 to 486

https://pikuma.com/blog/history-of-x86-4004-to-486
6•ibobev•43m ago•0 comments

A Primer on Fourier Series

https://arxiv.org/abs/2510.18203
3•teleforce•46m ago•0 comments

Microsoft's ONNX Runtime has disappeared from GitHub

https://github.com/microsoft/onnxruntime
408•nvader•16h ago•82 comments

My Emacs 31 contributions

https://xenodium.com/my-emacs-31-contributions
86•xenodium•2d ago•8 comments

Highly classified US national security communications network goes down

https://www.cnn.com/2026/11/17/politics/highly-classified-national-security-communications-networ...
648•monkeydust•23h ago•720 comments

Archive Team is archiving the Apple Support Community

https://wiki.archiveteam.org/index.php/Apple_Discussions
244•digitaldragon•15h ago•98 comments

Harvard researchers find AI coding agents shifted the bottleneck to code review

https://complexdiscovery.com/harvard-researchers-find-ai-coding-agents-shifted-the-bottleneck-to-...
269•judahmeek•18h ago•355 comments

Phrack 73

https://phrack.org/issues/73/introduction_md
438•notmine1337•20h ago•61 comments

MAI Code 2 and Code 2 Flash

https://microsoft.ai/news/introducing-mai-code-2-and-mai-code-2-flash/
396•lemonish97•21h ago•160 comments

350 years ago, Ole Rømer discovered that light has a finite speed

https://www.sciencenorway.no/culture-history-history-of-science/350-years-ago-this-man-discovered...
380•dxs•20h ago•123 comments

jQuery 4.1.0

https://github.com/jquery/jquery/releases/tag/4.1.0
355•petecooper•19h ago•186 comments

Claude was trained on protein sequences at scale

http://xinmingtu.cn/blog/2026/claude-opus-5-5-protein-sequences/
123•gmays•11h ago•56 comments

AI is killing All About Berlin

https://nicolasbouliane.com/blog/death-by-ai
638•grey-area•8h ago•591 comments