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•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.

Project Hail Mary – Stellar Navigation Chart

https://valhovey.github.io/gaia-mary/
879•speleo•16h ago•192 comments

CODA: Rewriting Transformer Blocks as GEMM-Epilogue Programs

https://arxiv.org/abs/2605.19269
55•matt_d•4h ago•4 comments

Slumber a TUI HTTP Client

https://slumber.lucaspickering.me
60•jicea•4h ago•26 comments

The surprising story behind the first British person in space

https://www.bbc.com/culture/article/20260518-helen-sharman-the-story-behind-the-first-british-per...
51•xoxxala•1d ago•11 comments

We should get rid of average CPU utilization

https://www.theocharis.dev/blog/why-we-should-get-rid-of-average-cpu-utilization/
18•JeremyTheo•53m ago•10 comments

Cleve Moler has died

https://www.mathworks.com/company/aboutus/founders/clevemoler.html
94•mychele•6h ago•7 comments

Blog ran on Ubuntu 16.04 for 10 years. I migrated it to FreeBSD

https://crocidb.com/post/this-blog-ran-on-ubuntu-16-04-for-10-years-i-migrated-it-to-freebsd/
278•speckx•14h ago•148 comments

The memory shortage is causing a repricing of consumer electronics

https://davidoks.blog/p/ai-is-killing-the-cheap-smartphone
184•d0ks•11h ago•195 comments

Deepfakes Tore a High School Apart

https://www.404media.co/radnor-high-school-pennsylvania-ai-deepfakes-child-sexual-abuse-material/
36•Brajeshwar•1h ago•26 comments

Was my $48K GPU server worth it?

https://rosmine.ai/2026/05/13/was-my-48k-gpu-worth-it/
439•apwheele•3d ago•319 comments

Uv is fantastic, but its package management UX is a mess

https://www.loopwerk.io/articles/2026/uv-ux-mess/
196•nchagnet•12h ago•103 comments

Using Kagi Search with Low Vision

https://veroniiiica.com/using-kagi-search-with-low-vision/
195•speckx•13h ago•63 comments

The death of the brick and mortar toy store

https://brainbaking.com/post/2026/05/the-death-of-the-brick-and-mortar-toy-store/
85•speckx•2d ago•75 comments

Indexing a year of video locally on a 2021 MacBook with Gemma4-31B (50GB swap)

https://blog.simbastack.com/indexed-a-year-of-video-locally/
373•asenna•19h ago•112 comments

Mycorrhizal Fungi, Nature's Key to Plant Survival and Success

https://pacifichorticulture.org/articles/mycorrhizal-fungi-natures-key-to-plant-survival-and-succ...
93•mooreds•1d ago•12 comments

Show HN: Freenet, a peer-to-peer platform for decentralized apps

https://freenet.org/
280•sanity•18h ago•172 comments

Lost Images from the 1945 Trinity Nuclear Test Restored

https://spectrum.ieee.org/trinity-nuclear-test
346•pseudolus•22h ago•104 comments

Python 3.15: features that didn't make the headlines

https://blog.changs.co.uk/python-315-features-that-didnt-make-the-headlines.html
375•rbanffy•21h ago•184 comments

Flipper One – we need your help

https://blog.flipper.net/flipper-one-we-need-your-help/
1149•sandebert•22h ago•442 comments

Tristan Davey's Punch Card Archive

https://punchcards.tristandavey.com/
27•ohjeez•2d ago•6 comments

Spotify will start reserving concert tickets for fans

https://www.hollywoodreporter.com/music/music-industry-news/spotify-will-start-reserving-concert-...
147•elffjs•16h ago•297 comments

Launch HN: Runtime (YC P26) – Sandboxed coding agents for everyone on a team

https://www.runtm.com/
85•gustrigos•17h ago•23 comments

Deciphering the Hashihara Castle Town Map

https://www.obayashi.co.jp/en/kikan_obayashi/detail/kikan_64_project.html
45•1970-01-01•2d ago•0 comments

Multi-Stream LLMs: new paper on parallelizing/separating prompts, thinking, I/O

https://arxiv.org/abs/2605.12460
106•atomicthumbs•13h ago•12 comments

Waymo pauses Atlanta service as its robotaxis keep driving into floods

https://techcrunch.com/2026/05/21/waymo-pauses-atlanta-service-as-its-robotaxis-keep-driving-into...
308•mattas•16h ago•389 comments

Throwing AI-generated walls of text into conversations

https://noslopgrenade.com/
603•napolux•23h ago•351 comments

Google's Antigravity bait and switch

https://www.0xsid.com/blog/antigravity-bait-n-switch
669•ssiddharth•19h ago•299 comments

We're testing new ad formats in Search and expanding our Direct Offers pilot

https://blog.google/products/ads-commerce/google-marketing-live-search-ads/
602•sofumel•23h ago•540 comments

News outlets are limiting the Internet Archive’s access to their journalism

https://www.niemanlab.org/2026/05/more-than-340-local-news-outlets-are-limiting-the-internet-arch...
281•jaredwiener•16h ago•94 comments

Seattle Shield, an intelligence-sharing network operated by the Seattle police

https://prismreports.org/2026/05/20/seattle-shield-private-companies-surveillance/
456•root-parent•15h ago•186 comments