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.

US strikes $1.2B deal to pay German firm to halt offshore wind projects

https://www.bbc.com/news/articles/c1e1vg0gjl5o
299•defrost•2h ago•263 comments

New Mexico court orders Meta to pay $567m over harms to children’s mental health

https://www.theguardian.com/technology/2026/aug/06/new-mexico-court-meta
383•boplicity•12h ago•237 comments

AMD acquires Taalas to boost inference performance by etching models in silicon

https://www.theregister.com/systems/2026/08/06/amd-acquires-ai-chip-startup-taalas-to-boost-infer...
731•itvision•16h ago•544 comments

Taste Is All That's Left

https://notashelf.dev/posts/taste-is-all-thats-left
487•tsak•19h ago•352 comments

Scientists discover Kelvin-Helmholtz Instability on the surface of the Sun

https://nso.edu/press-release/nsf-inouye-solar-telescope-enables-major-discovery-of-a-hidden-sola...
250•neversaydie•1d ago•53 comments

Atomic Clocks

https://www.nist.gov/atomic-clocks/how-do-atomic-clocks-work
99•teleforce•6d ago•53 comments

Bioengineered chewing gum may offer a way to fight HPV and other microbes

https://www.sciencedaily.com/releases/2026/08/260803080917.htm
148•Audiophilip•15h ago•43 comments

São Paulo resident transforms degraded area into urban forest

https://saopaulosecreto.com/en/tiquatira-linear-park-en/
178•rmason•5d ago•69 comments

A quine in Piet – a GIF image that prints itself [video]

https://www.youtube.com/watch?v=GwMtzhjCzyc
23•surprisetalk•3d ago•1 comments

GitHub Actions and Pages are experiencing degraded availability

https://www.githubstatus.com/incidents/qcvjkzcs7j74
426•Footkerchief•20h ago•348 comments

Improving GPT‑5.6 Sol in ChatGPT, expanding GPT‑5.6 Luna access for free users

https://openai.com/index/improving-gpt-5-6-sol-in-chatgpt/
259•tedsanders•19h ago•201 comments

What is a product?

https://roge.onwrite.app/what-is-a-product
74•rogix•15h ago•46 comments

Launch HN: ProvenMetal (YC S26) delivers circuit boards in days instead of weeks

https://provenmetal.com
209•willcarkner•20h ago•148 comments

The Gargantuan Lie That Is Collapsing the Climate

https://www.currentaffairs.org/news/the-massive-climate-lie-that-will-destroy-human-civilization
97•Anon84•1h ago•65 comments

Welcoming the Nepalese Government to Have I Been Pwned

https://www.troyhunt.com/welcoming-the-nepalese-government-to-have-i-been-pwned/
171•gnabgib•14h ago•27 comments

Reverse Jevons Paradox

https://mht.wtf/post/jevons/
46•martinhath•3d ago•38 comments

Herdr is joining Y Combinator. The runtime stays open

https://herdr.dev/blog/herdr-is-joining-y-combinator/
225•collinmanderson•17h ago•161 comments

I stopped trusting USB-C cable labels and started testing them

https://www.makeuseof.com/i-stopped-trusting-usb-c-cable-labels-started-testing-with-meter-instead/
220•baranul•4d ago•183 comments

Humans missed 1 in 3 threats approving AI agent commands across 40k game runs

https://scalex.dev/blog/ai-agent-permissions-stats/
316•Wirbelwind•1d ago•223 comments

TypeStax: A type scale generator with vintage audio hardware interface

https://www.typestax.com/
4•jasim•1w ago•1 comments

My phone detects going on a run as “someone snatching my phone and running off”

https://mastodon.gamedev.place/@rygorous/117047697255584965
157•luu•18h ago•267 comments

The BBC Tetris Companion

https://www.leadedsolder.com/2026/07/28/bbc-bridge-companion-part-1-overview.html
22•zdw•1w ago•2 comments

Why Estonians invite strangers into their back gardens each summer

https://www.bbc.com/travel/article/20260731-why-estonians-invite-strangers-into-their-backyards-e...
96•koolhead17•3d ago•38 comments

Mario Meets Pareto

https://www.mayerowitz.io/blog/mario-meets-pareto
1068•theanonymousone•1d ago•160 comments

STV: A full-motion video codec for the Atari ST

https://medium.com/@jonas.eschenburg/stv-a-video-codec-for-the-atari-st-6e46355c50e4
71•indyjo•1w ago•10 comments

Show HN: Certo – An open source platform to deliver Open Badges

https://github.com/schroedinger-Hat/certo
5•thejoin95•3h ago•0 comments

Learn how chips are made with this Rollercoaster Tycoon-inspired animation

https://laurentiugabriel.github.io/ChipTycoon/
178•laurentiurad•1w ago•57 comments

New Orleans is testing Carbyne’s AI-powered Emergency Call Triage software

https://www.shreveporttimes.com/story/news/local/louisiana/2026/07/28/is-new-orleans-using-ai-to-...
65•champagnepapi•11h ago•99 comments

Framework discloses data breach via Metabase 0-day

https://community.frame.work/t/framework-data-breach-discussion/83939
106•RobinHirst11•7h ago•40 comments

Inside vLLM: Anatomy of a High-Throughput LLM Inference System (2025)

https://www.aleksagordic.com/blog/vllm
121•sebg•15h ago•7 comments