frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

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•9mo ago

Comments

quentinp•9mo 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•9mo ago
Page didnt load for me.

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

Multiprocessing all the way!

emmelaich•9mo ago
(2021)

Good article!

punnerud•9mo 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•9mo 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•9mo ago
How does the GIL come into play here?
punnerud•9mo 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.

We Will Not Be Divided

https://notdivided.org
1282•BloondAndDoom•6h ago•467 comments

How do I cancel my ChatGPT subscription?

https://help.openai.com/en/articles/7232927-how-do-i-cancel-my-chatgpt-subscription
400•tobr•1h ago•87 comments

Croatia declared free of landmines after 31 years

https://glashrvatske.hrt.hr/en/domestic/croatia-declared-free-of-landmines-after-31-years-12593533
170•toomuchtodo•4h ago•18 comments

Don't use passkeys for encrypting user data

https://blog.timcappalli.me/p/passkeys-prf-warning/
116•zdw•4h ago•61 comments

Rust Is Just a Tool

https://lewiscampbell.tech/blog/260204.html
34•JuniperMesos•1h ago•10 comments

Cash issuing terminals

https://computer.rip/2026-02-27-ibm-atm.html
42•zdw•2h ago•1 comments

OpenAI agrees with Dept. of War to deploy models in their classified network

https://twitter.com/sama/status/2027578652477821175
471•eoskx•4h ago•264 comments

U.S. and Israel Conduct Strikes on Iran

https://www.nytimes.com/live/2026/02/28/world/iran-strikes-trump
60•gammarator•46m ago•6 comments

Show HN: I ported Manim to TypeScript (run 3b1B math animations in the browser)

https://github.com/maloyan/manim-web
81•maloyan•2d ago•13 comments

OpenAI raises $110B on $730B pre-money valuation

https://techcrunch.com/2026/02/27/openai-raises-110b-in-one-of-the-largest-private-funding-rounds...
469•zlatkov•16h ago•513 comments

A new California law says all operating systems need to have age verification

https://www.pcgamer.com/software/operating-systems/a-new-california-law-says-all-operating-system...
545•WalterSobchak•16h ago•510 comments

Smallest transformer that can add two 10-digit numbers

https://github.com/anadim/AdderBoard
136•ks2048•1d ago•57 comments

Statement on the comments from Secretary of War Pete Hegseth

https://www.anthropic.com/news/statement-comments-secretary-war
841•surprisetalk•6h ago•287 comments

Package Managers à la Carte: a formal model of dependency resolution

https://arxiv.org/abs/2602.18602
20•avsm•3d ago•1 comments

Qt45: A small polymerase ribozyme that can synthesize itself

https://www.science.org/doi/10.1126/science.adt2760
76•ppnpm•8h ago•14 comments

A Chinese official’s use of ChatGPT revealed an intimidation operation

https://www.cnn.com/2026/02/25/politics/chatgpt-china-intimidation-operation
195•cwwc•15h ago•119 comments

A better streams API is possible for JavaScript

https://blog.cloudflare.com/a-better-web-streams-api/
400•nnx•17h ago•137 comments

NASA announces overhaul of Artemis program amid safety concerns, delays

https://www.cbsnews.com/news/nasa-artemis-moon-program-overhaul/
247•voxadam•15h ago•267 comments

5,300-year-old 'bow drill' rewrites story of ancient Egyptian tools

https://phys.org/news/2026-02-year-drill-rewrites-story-ancient.html
4•PaulHoule•2d ago•0 comments

Bootc and OSTree: Modernizing Linux System Deployment

https://a-cup-of.coffee/blog/ostree-bootc/
20•mrtedbear•4h ago•2 comments

Israel launches strike against Iran, declares state of emergency across country

https://www.cnn.com/2026/02/28/middleeast/israel-attack-iran-intl-hnk
44•lavp•1h ago•10 comments

Eschewing Zshell for Emacs Shell (2014)

https://www.howardism.org/Technical/Emacs/eshell-fun.html
26•pvdebbe•3d ago•9 comments

Open source calculator firmware DB48X forbids CA/CO use due to age verification

https://github.com/c3d/db48x/commit/7819972b641ac808d46c54d3f5d1df70d706d286
167•iamnothere•16h ago•87 comments

Time-Travel Debugging: Replaying Production Bugs Locally

https://lackofimagination.org/2026/02/time-travel-debugging-replaying-production-bugs-locally/
12•tie-in•2d ago•1 comments

Show HN: Claude-File-Recovery, recover files from your ~/.claude sessions

https://github.com/hjtenklooster/claude-file-recovery
74•rikk3rt•15h ago•30 comments

Inventing the Lisa user interface – Interactions

https://dl.acm.org/doi/10.1145/242388.242405
33•rbanffy•2d ago•2 comments

Show HN: Unfucked - version all changes (by any tool) - local-first/source avail

https://www.unfudged.io/
88•cyrusradfar•1d ago•47 comments

Let's discuss sandbox isolation

https://www.shayon.dev/post/2026/52/lets-discuss-sandbox-isolation/
130•shayonj•12h ago•43 comments

Writing a Guide to SDF Fonts

https://www.redblobgames.com/blog/2026-02-26-writing-a-guide-to-sdf-fonts/
91•chunkles•13h ago•6 comments

Allocating on the Stack

https://go.dev/blog/allocation-optimizations
144•spacey•15h ago•51 comments