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.

Ruff v0.16.0 – Significant new updates – 413 default rules up from 59

https://astral.sh/blog/ruff-v0.16.0
91•vismit2000•2h ago•39 comments

Elevated Errors for Opus 5

https://status.claude.com/incidents/zftg3gqkmv18
38•TimCTRL•2h ago•35 comments

GrapheneOS protections against data extraction from locked devices

https://discuss.grapheneos.org/d/40700-grapheneos-protections-against-data-extraction-from-locked...
118•Cider9986•5h ago•55 comments

A shell colon does nothing. Use it anyway

https://refp.se/articles/your-shell-and-the-magic-colon
233•olexsmir•22h ago•94 comments

German Peasants' War

https://en.wikipedia.org/wiki/German_Peasants%27_War
9•constantius•3d ago•7 comments

An ESP32 based plane radar for my desk

https://blog.ktz.me/esp32-plane-radar/
170•alexktz•9h ago•35 comments

The new rules of context engineering for Claude 5 generation models

https://claude.com/blog/the-new-rules-of-context-engineering-for-claude-5-generation-models
356•mellosouls•15h ago•248 comments

DeepSeek pause fundraise after comments on compute gap to US leaked (transcript) [pdf]

https://github.com/demo-zexuan/liang-wenfeng-investor-meeting-2026-7-22/blob/master/%E6%A2%81%E6%...
176•oliculipolicula•12h ago•126 comments

Inflect-Micro-v2: complete voice in 9.36M parameters

https://huggingface.co/owensong/Inflect-Micro-v2
146•nateb2022•11h ago•11 comments

Show HN: I mapped every US golf course

https://golfcoursebrowser.com/
144•rickmf•9h ago•79 comments

Alien World Chemistry Found Inside Meteorite That Struck New Jersey Home

https://www.seti.org/news/alien-world-chemistry-found-inside-meteorite/
83•spzx•10h ago•22 comments

Stinkpot: SQLite-backed shell history

https://tangled.org/oppi.li/stinkpot
74•nerdypepper•1d ago•23 comments

Cloudflare's new AI traffic options for customers

https://blog.cloudflare.com/content-independence-day-ai-options/
133•alphabetatango•12h ago•108 comments

Overloaded Overloading

https://powerfulpython.com/blog/overloaded-overloading/
19•redsymbol•3d ago•6 comments

Some more things about Django I've been enjoying

https://jvns.ca/blog/2026/07/21/more-nice-django-things/
54•surprisetalk•4d ago•27 comments

Running a 28.9M parameter LLM on an $8 microcontroller

https://github.com/slvDev/esp32-ai
205•boveyking•16h ago•48 comments

Git rebase -I is not that scary

https://cachebag.sh/journal/interactive-rebasing/
78•vinhnx•11h ago•94 comments

What is happening to jobs? Separating AI hype from reality

https://siepr.stanford.edu/publications/policy-brief/what-really-happening-jobs-separating-ai-hyp...
111•pod_krad•12h ago•134 comments

Rethinking Legal Education in the AI Era

https://www.law.uchicago.edu/news/ai-strategy-statement
83•jjwiseman•2d ago•49 comments

LLM Usage in Debian: Three Proposals

https://www.debian.org/vote/2026/vote_002
170•zdw•15h ago•154 comments

DskDitto: Ultra-fast, parallel duplicate-file detector

https://github.com/jdefrancesco/dskDitto
25•ingve•4d ago•5 comments

Systemd Linger

https://etbe.coker.com.au/2026/07/24/systemd-linger/
5•edward•1h ago•0 comments

Pip install Postgres – no Docker/Brew/apt

https://github.com/leontrolski/postgresql-testing
10•leontrolski•2d ago•3 comments

JetZero

https://www.jetzero.aero
210•lisper•8h ago•176 comments

Clinical failure rates over the decades: yikes

https://www.science.org/content/blog-post/clinical-failure-rates-over-decades-yikes
109•EA-3167•12h ago•88 comments

SIMD for Collision

https://box2d.org/posts/2026/07/simd-for-collision/
103•birdculture•3d ago•28 comments

Systems and Delays

https://martin.janiczek.cz/2026/07/24/systems-and-delays.html
65•vinhnx•11h ago•14 comments

No Stack Overflow, No Autocomplete: What Coding Felt Like in the 80s

https://comuniq.xyz/post?t=1439
17•01-_-•1h ago•16 comments

GM Backs Sodium Ion Batteries for U.S. Grid Storage

https://spectrum.ieee.org/sodium-ion-battery-peak-energy
182•rbanffy•13h ago•82 comments

Show HN: Brolly, a plain-text weather forecast site

https://brolly.sh/forecast/RWFP2qW8
201•jsax•18h ago•71 comments